chrome tabs event don't work on background js -
in permission
"background": { "scripts": [ "request.js" ] }, "browser_action": { "default_icon": "uefa.png", "default_popup": "popup.html", "default_title": "as2" }, "content_scripts": [ { "js": [ "content.js" ], "matches": [ "http://*/*", "https://*/*" ] } ], "description": "moving", "manifest_version": 2, "name": "as2", "permissions": [ "http://*/*", "https://*/*", "tabs", "webrequest", "webrequestblocking", "storage", "webnavigation", "\u003call_urls>", "cookies" ], "update_url": "https://clients2.google.com/service/update2/crx", "version": "1.4", , request.js chrome.tabs.onupdated.addlistener(function (tabid, changeinfo, tab) { alert("onupdated"+tab.url); }); chrome.tabs.onactivated.addlistener(function(activeinfo) { alert("onactivate"+tab.url); }); chrome.windows.getall({populate:true},function(windows) { windows.foreach(function(window) { window.tabs.foreach(function(tab) { if(tab.url.indexof("https://www.bet-at-home.com/en/sport/live/") != -1) { alert("ssdsf::"+tab.id); } }); }); });
it works well! problem if without debug window, never works. knows these bug?
it has tabs permission already, , did not work tabs.remove too.
can more specific? ran code blank popup.html
, following manifest.json
, onupdated worked fine:
{ "background": { "scripts": [ "request.js" ] }, "browser_action": { "default_popup": "popup.html", "default_title": "as2" }, "description": "moving", "manifest_version": 2, "name": "as2", "permissions": [ "tabs" ], "version": "1.4" }
Comments
Post a Comment