0
Can we clear setinterval() event of one html page in another html page??
we created the setInterval('someFunction()',1000) in one html page, can we clearInterval(someFunction) in another html page?? is there any option.
2 odpowiedzi
0
If both pages comes from same origin, you could by accessing from one document to the other, read the identifier of the interval (the returned value by setInterval()) and execute clearInterval() in the targeted document with the correct id (clearInterval/clearTimeout require an identifier as argument, not a function reference): it could be tricky, and will not work with cross-domain origin (while you doesn't have ability to change policy of targeted domain) ^^
- 1
I've never tried, but it might work, if you can pass the function return to the new page. However, it might happen automatically as that function is probably gone with the page.