Reputation: 11
I've created an extension for Google Chrome. There are no errors when uploaded, and the button appears just fine on the extension bar. The extension is supposed to play a sound when clicked, but it does not. Here is my manifest.json file:
{
"manifest_version": 2,
"name": "Extension",
"description": "My Extension",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_title": "Extension",
"js": ["audio.js"]
},
"permissions": [
"activeTab",
"https://ajax.googleapis.com/"
]
}
and here is my audio.js file:
var myAudio = new Audio();
myAudio.src = "audio.mp3";
myAudio.play();
I don't see my issue here. Any and all help is appreciated!
Upvotes: 0
Views: 1138
Reputation: 73846
"js"
parameterAlternatively use a dynamically loaded event page with a click handler and omit the popup:
manifest.json:
"browser_action": {
"default_icon": "icon.png",
"default_title": "Extension"
},
"background": {
"scripts": ["event.js"],
"persistent": false
},
event.js
chrome.browserAction.onClicked.addListener(function(tab) {
var myAudio = new Audio();
myAudio.src = "audio.mp3";
myAudio.play();
});
See the official samples for more examples of browserAction
API.
Upvotes: 3