开发者

chrome extension javascript problem

开发者 https://www.devze.com 2023-04-07 11:17 出处:网络
I started trying to write chrome extension and I\'m having problem with simple function: script inside \"backgroound.html\":

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"]
} 
0

精彩评论

暂无评论...
验证码 换一张
取 消