Home  >  Article  >  Web Front-end  >  Commonly used js.window properties and methods (detailed introduction, graphic tutorial)

Commonly used js.window properties and methods (detailed introduction, graphic tutorial)

亚连
亚连Original
2018-05-18 14:49:511968browse

The following are the js.window properties and methods that I have compiled for you. Interested students can take a look.

##window.opener.location.reload()

##​​

This method In the case of some IE browsers (such as high security settings), a confirmation dialog box will pop up, prompting whether to refresh the page again. This method is replaced by window.opener.location.href=window.opener.location .href;There will be no such problem.

window.opener.location.href is just a link

If you want to realize the submission of the parent window, you need to call the window.opener.action="" and window.opener.submit(); methods, but unfortunately this code cannot run under Firefox. The solution is to Write a submitted function in the window and call it through window.opener.functionname() in the child window.

Usually when using window.opener, you have to judge the status of the parent window. If the parent window is closed or updated, an error will occur. The solution is to add The following verification if(window.opener && !window.opener.closed)

window.opener.location.replace();

This method specifies URLReplace the item currently cached on the client, so after using the replace method, you cannot access the replaced URL through "forward" and "backward". In actual application, when refreshing the page, we usually use: location.reload() or history.go(0).
Because this approach is like the client clicking F5 to refresh the page, so when the page method="post" is used, a "webpage expired" prompt will appear. That's because of Session's security protection mechanism.

Method to open the window:

Method 1:

Response.Write("<script language=javascript>window.open(&#39;down.aspx&#39;,&#39;newwindow&#39;,&#39;width=200,height=200&#39;)</script>");

Method 2:

Response.Write("<script language=javascript>alert(&#39;注册成功&#39;);window.window.location.href=&#39;down.aspx&#39;;</script> ");

The above is the js.window properties and methods I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

JS loading jquery.jsDetailed steps

Three types of JS loading Summary of method usage

#Several common JS sorting codes on the front end

The above is the detailed content of Commonly used js.window properties and methods (detailed introduction, graphic tutorial). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn