How To Periodically Check Whether A Tab Is Created Or Not, Just When The Chrome Extension Is Installed
I have set my website as a chrome extension.Presently when I click on the extension icon,it navigates to website's login page.And it access a server file and set's the color of the
Solution 1:
If you want to perform a periodic check, you can utilize the chrome.alarms API (which will also work with non-persistent background-pages - in contrast to window.setInterval
).
E.g.:
In manifest.json
:
"permissions": [
"alarms",
...
In background.js
:
...
var checkInterval = 5;
chrome.alarms.create("checkServer", {
delayInMinutes: checkInterval,
periodInMinutes: checkInterval
});
chrome.alarms.onAlarm.addListener(function(alarm) {
if (alarm.name === "checkServer") {
updateIcon();
}
});
Post a Comment for "How To Periodically Check Whether A Tab Is Created Or Not, Just When The Chrome Extension Is Installed"