Sample usage of js setTimeout opener

  • 2020-03-26 21:40:00
  • OfStack

 
$("#saveInfo").show(); 
setTimeout( '$("#saveInfo").hide();',3000); 
if(opener&& !opener.closed){ 
opener.location.reload(true); 
} 

SetTimeout: how long to delay the execution of what method, specific use: (link: #)

Opener: refers to the parent presentation window. For example, an A page invokes A B page with an iframe or frame, so the parent of the B page is the window in which the A page is located. In JS, window.opener is just a reference to the parent window of the pop-up window. For example, in a.html, a new window b.html is opened by clicking the button. Then in b.html, you can reference a.html by window.opener (omitted as opener), including objects such as document of a.html, and manipulate the contents of a.html.
If the reference fails, null is returned. So before calling the opener object, determine if the object is null, or you'll get a "object is empty or not" JS error.

Related articles: