I started trying to write chrome extension and I'm having problem with simple function:
script inside "backgroound.html":
chrome.tabs.onUpdated.addListener(function(tabId,changedInfo,tab){alert("a")});
manifest.json
file:
{
"na开发者_运维技巧me": "ogys",
"version": "1.0",
"description": "description",
"browser_action": {
"default_icon": "icon.png",
"background_page": "background.html"
},
"permissions": ["tabs", "http://code.google.com/"]
}
I understand that an change on any tab would trigger the event but nothing happends.
According with code.google.com, you've defined the backround_page
in the wrong place.
Move the background_page
property definition outer from browser_action
action in this way:
{
"name": "ogys",
"version": "1.0",
"description": "description",
"browser_action": {
"default_icon": "icon.png"
},
"background_page": "background.html",
"permissions": ["tabs", "http://code.google.com"]
}
精彩评论