Reputation: 127
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 programmatically. i.e on page load the extension should run automatically
https://github.com/NicolaeNMV/BehindTheOverlay
i want to add delay before this line
chrome.tabs.executeScript(null, {file: "overlay_remover.js"});
how to do this?
chrome.tabs.onUpdated.addListener( function (tabId, changeInfo, tab) {
if (changeInfo.status === 'complete' && tab.active) {
// add some delay here
chrome.tabs.executeScript(null, {file: "overlay_remover.js"});
}
})
Upvotes: 0
Views: 1896
Reputation: 2869
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
Upvotes: 1