At
http://developer.chrome.com/extensions/samples.html 2nd sample titled:
"A browser action with no icon that makes the page red"
I downloaded the 3 files (manifest, js, icon) and installed the extension sample.
When I run it I get a puzzle icon on the bar with a badge that increments every second.
When I click on the icon - nothing
When I click on the page - nothing
I also cannot see the supplied icon being used anywhere.
I don't know if this is a code issue or a usage issue.
manifest.json:
{
"name": "A browser action with no icon that makes the page red",
"version": "1.0",
"background": { "scripts": ["background.js"] },
"permissions": [
"tabs", "http://*/*"
],
"browser_action": {
"name": "Make this page red",
"icons": ["icon.png"]
},
"manifest_version": 2
}
background.js file
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(
null, {code:"document.body.style.background='red !important'"});
});
chrome.browserAction.setBadgeBackgroundColor({color:[0, 200, 0, 100]});
var i = 0;
window.setInterval(function() {
chrome.browserAction.setBadgeText({text:String(i)});
i++;
}, 10);