Skip to content Skip to sidebar Skip to footer

Run Chrome Extension On Page Load

i have found this extension Behind The Overlay which removes the overlay on the webpage that we visit. for doing so we have to click on the extension icon. i want to do this progra

Solution 1:

You can do that by editing your background.js replacing alert() with chrome.tabs.executeScript(null, {file: "/js/overlay_remover.js"}); and include the overlay remover in your files:

chrome.tabs.onUpdated.addListener( function (tabId, changeInfo, tab) {
  if (changeInfo.status === 'complete' && tab.active) {
    setTimeout(() => {
      chrome.tabs.executeScript(null, {file: "overlay_remover.js"});
    }, 3000); // 3000 = delay in milliseconds (3 seconds)
  }
})

Note that you should keep your manifest the same and keep your background.js

Post a Comment for "Run Chrome Extension On Page Load"