I want to create a timer that will reload extensions every 10 minutes.
This works, except the window doesn't open. I tried it with www.google.com as well
any thoughts?
var count = 0
var jsUpdatePageTimer = setInterval(updatePage, 5000)
function updatePage(){
console.log(count)
if (count == 3) {
console.log('count is 3')
clearInterval(jsUpdatePageTimer)
} else {
console.log('updating count')
window.open('http://reload.extensions')
count +=1
}
}
popup blockers like to block calls to window.open — you may remember the terrible days when javascript could open popups willy-nilly
nowadays, for window.open to work, you have to use it within a user-initiated call stack
which means, you can only use window.open as the result of a user-triggered event, like a mouse click
button.onclick = () => {
window.open(/*...*/)
}
so you need to ask yourself: what is the relevant user action that should trigger this popup? you need to have the user's consent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With