Search Results

Search found 1 results on 1 pages for 'youhan'.

Page 1/1 | 1 

  • chrome extension script is loading twice even more on some pages

    - by Youhan
    this is my background.js file chrome.tabs.onUpdated.addListener(function(tabId,info, tab) { var sites =new Array('site2','site1'); var url=tab.url; var siteFlag=0; for(var i in sites) { var regexp = new RegExp('.*' + sites[i] + '.*','i'); if (regexp.test(url)) {siteFlag=1;} }; if(siteFlag==1){ chrome.tabs.executeScript(tabId, {file:"contentscript.js"}); chrome.tabs.executeScript(tabId, {file:"jquery.js"}); chrome.tabs.insertCSS(tabId,{file:"box.css"}); } }); In the contentscript.js I simply run a popup box. $(document).ready(function () { function popup() {...} if (window.addEventListener) { window.addEventListener('load', popup(), false); } else if (window.attachEvent) { window.attachEvent('onload', popup()); } }); There are some pages that there are one popup-box and there are pages that two or even more what is the problem?

    Read the article

1