Skip to content

getting error while trying to play Audio from URL in chrome extension

I tried many ways to play a sound from the URL but it isn’t working.

When I inspected the page have errors console:

chrome-extension://invalid/:1 GET chrome-extension://invalid/ net::ERR_FAILED

Uncaught (in promise) DOMException: Failed to load because no supported source was found.


"options_page": "./html/content.html",
"permissions": [
"web_accessible_resources": [

I’m doing this in options_page that is content.html. I have also given ‘web_accessible_resources’ permission to the script, but still no success. All the audio links are stored in chrome storage.

Script that’s attached in content.html:

document.addEventListener('click', function (e) { 
if ('.audioBtn')) {{ meanifyWords: [] }, (result) => { 
        let getWordsObj = result.meanifyWords;
        let getAudio = getWordsObj[].audio;  //getAudio="//"
        let sound = new Audio(getAudio);;

Please point me to any changes in the above code that will solve this problem. Thanks in advance.


Add schema to URL:

let getAudio = "https:" + getWordsObj[].audio;