(window,parent,opener,top). Location.reload Method Summary

Source: Internet
Author: User

The recent project is to work with some degree to integrate them with a feature to our products. Because it is halfway from the hands of the work, and the first use of JSONP, not familiar with the page refresh jump, the pit miserable, now to record the situation, hoping to have a similar demand for comrades to bring a little help.

Scenario Description:

Login Login.html Page Login verification success, jump to the index.html page, index.html page loading completed will send JSONP request to the other server to get the data and show it, if not landing a degree of account, pop-up information. Then need to click the Landing button on the page, pop up a certain degree of landing box (IFrame introduced), landing a certain degree of success (a certain degree of processing judgment), refresh the page, re-display the data.

Processing tips:

A certain degree landing after the successful need to jump to a new page, due to the introduction of the IFRAME, so the use of an intermediate page cs.html, and then in this cs.html page to refresh the outermost page. At the beginning of the cs.html is used in the top.location.reload (), This method in non-IE kernel browser is normal, but in the IE kernel browser always prompt no login (actually logged in successfully) This pit took a lot of time, finally I replaced this method with top.location.href, and then see IE kernel browser can be normal, the first time to use this, is too depressed.

Attach some information collected on the Internet

window.location.reload () refreshes the current page.
parent.location.reload () Refresh Father object (for frame)
opener.location.reload () refreshes the parent window object (for single-open window)
top.location.reload () Refreshes the topmost object (for multiple open windows)

In addition, the syntax for two methods is described:

Reload   method that forces the browser to refresh the current page.
syntax: location.reload ([ bforceget ]) parameter:   bforceget , optional parameter, default is False, the current page is taken from the client cache. True to get  , fetch the latest page from the server, equivalent to the client click F5 ("Refresh")

Replace   method, which replaces items currently cached in history (clients) by specifying a URL , so after using the Replace method, you cannot access the replaced by "forward" and "back" URL .
syntax: location.replace ( URL ) parameter:   URL

In the actual application, when re-refresh the page, we usually use: Location.reload () or history.go (0) to do. Because this practice is like the client point F5 Refresh the page, so the page method= "POST", there will be "page expiration" prompt. That's because of the session's security protection mechanism. It can be thought that when the Location.reload () method is called, the ASPX page is already present in the server memory, so it must be IsPostback. If there is such an application: We need to reload the page, which means we expect the page to be re-created on the server and we expect it to be not IsPostback. Here, Location.replace () can complete this task. The Replace page is regenerated on the server each time. You can write this: Location.replace (location.href)


The final content is just discovered, do not know I this place top.location.reload (true), This can solve the problem of IE kernel not, take the time to the company to try.

Have to know the specific reasons for the difference, hope you Daniel told, we encourage each other! 3Q


(window,parent,opener,top). Location.reload Method Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.