I am writing a simple page action extension that is displayed for every tab and simple writes something to the console upon executing. However, I get the following error in the javascript debugger - "Uncaught TypeError: Cannot call method 'addListener' of undefined". I can't figure out why this is happening.
My manifest.json is:
and my enable.html is:Code:{ "background_page": "enable.html", "name": "HUL Redirect Extension", "version": "1.0", "description": "Extension for redirecting through HUL Proxy", "page_actions": [ { "id": "hulredirect", "icons": ["RedirectIcon.png"], "name": "HUL Redirect" } ] }
Any help would be greatly appreciated.Code:<html> <head> <script type="text/javascript"> chrome.tabs.onUpdated.addListener(function(tabid) { chrome.tabs.get(tabid, function(currentTab) { chrome.pageActions.enableForTab('hulredirect', { tabId: currentTab.id, url: currentTab.url, title: "HUL Redirect", iconId: 0 }); }); }); chrome.pageActions["hulredirect"].addListener(function(pageaction) { console.log("Test"); }); </script> </head> <body> </body> </html>
Thanks,
Rajesh


LinkBack URL
About LinkBacks



Reply With Quote

