page structure is divided into three parts: upper, middle and lower, in which there is a iframe
. Each time a different link address is sent from the background to show a different interface, this is dynamic.
where the content of the src of iframe is the domain name + the page link
from the background to determine the content to be displayed. When I first opened the page, I brought my own page link. I now want to make every time the page is refreshed, it is by passing parameters to the background to call the same method when the page is opened, and then it is tantamount to saying that the page is still open.
the code for refreshing the page I found on the Internet is as follows:
window.onload = function (){
if(window.attachEvent){
window.attachEvent("onbeforeunload",onbeforeunload_handler());
}else{
window.addEventListener("onbeforeunload", onbeforeunload_handler(),false);
}
}
but the problem with this is that the onbeforeunload_handler ()
method is executed the first time the page is opened, which is tantamount to falling into an endless loop. I have been looking for a solution on the Internet for a long time. Please take a look at it with the help of the god who knows how to solve it. Thank you.