romand
romand

Reputation: 29

chrome extension javascript problem

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:

{
  "name": "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.

Upvotes: 1

Views: 167

Answers (1)

user278064
user278064

Reputation: 10170

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

Upvotes: 1

Related Questions