1

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.

1
  • It's better to use console.log() instead of alert(). Not sure whether an alert on the background page is even visible. You can open the console for the background page on the add-ons page, you will see the log messages then. Commented Sep 24, 2011 at 9:57

1 Answer 1

1

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"] } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.