Skip to content
Advertisement

Chrome Extension: Confirm window is not appearing on currently using tab? it just appear on one tab (popup.html)

I am developing chrome extension for e-gym that generates confirm window for using chrome browser after every one hour. I have developed chrome extension but the confirm window is only appearing on popup.html. I want to turn on my extension let it generate window.confirm on any tab that I am using currently after 1 hour. here’s my code:

manifest.json:

JavaScript

**popup.html: **

JavaScript

popup.js:

JavaScript

Kindly help me with this task. I just want that confirm window on a tab that I am using or working after one hour. for the sake of simplicity and setting I have set it to 10 seconds.

I am expecting to generate confirm window to popup/appear at any tab that i am using after one hour is over.

Advertisement

Answer

It sounds like what you want to do is query for the active tab and inject the script with the confirmation prompt at the time the countdown ends, not when it starts. The way I’d do this is by setting up an alarm, and do the tabs.query and executeScript in response to the alarm going off.

Advertisement