javascript - Injected script execute twice in Chrome Extension -
this popup.js it's included in popup.html, trigger when click on browser action's icon.
chrome.tabs.query({ active: true, currentwindow: true }, function (tabs) { var tabid = tabs[0]; chrome.tabs.update(null, { url: 'https://example.com/login.php' }, function () { chrome.tabs.onupdated.addlistener(function (tabid, changeinfo, tab) { if (changeinfo.status == 'complete') { chrome.tabs.executescript(null, { file: "jquery.js" }, function () { chrome.tabs.executescript(null, { file: "setlogin.js" }); }); } }); }); i have alert() within setlogin.js, have no idea why execute twice. expect trigger once have set execute script within changeinfo.status == 'complete' block.
Comments
Post a Comment