Window.location.href/replace/reload ()--page jump + replace + Refresh

Source: Internet
Author: User

Original address: http://jun1986.iteye.com/blog/1176909

--------------------------------------------------------------------------------------------------------------- ---------------------------------------------------

First, outermost top jump page, suitable for the IFRAME frameset

Top.window.location.href ("${pagecontext.request.contextpath}/login_goback");

============================================================================================

Ii. the difference between window.location.href and Window.location.replace

1.window.location.href= "url": Change the URL address;

2.window.location.replace ("url"): Replace the address with a new URL, which replaces the currently cached item in history (client) by specifying a URL.
So when you use the Replace method, you can't access the URLs that have been replaced by "forward" and "back", which is useful for making transition pages!

Third, forced page refresh

1.window.location.reload (): Force refresh page, request again from server!

============================================================================================

Iv. window.location.reload (); page implementation jump and Refresh

1 history.go (0)
2 Location.reload ()
3 location=location
4 Location.assign (location)
5 Document.execcommand (' Refresh ')
6 Window.navigate (location)
7 Location.replace (location)
8 document. Url=location.href
These can all be refreshed.
Window.location.reload (); refresh
Window.location.href=window.location.href; refresh
Window.close (); Close the window, do not eject the system prompt, close directly
Window.close () equivalent to the Self property is the current window
Window.parent.close () is the parent property is the frame group of the current window or frame
Page implementation jumps nine ways to do the example:
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>navigate</title>
<script language= "JavaScript" >
SetTimeout (' Window.navigate ("top.html"); ', 2000);
SetTimeout (' window.document.location.href= ' top.html "; ', 2000);
SetTimeout (' window.document.location= ' top.html "; ', 2000);
SetTimeout (' window.location.href= ' top.html "; ', 2000);
SetTimeout (' window.location= ' top.html "; ', 2000);
SetTimeout (' document.location.href= ' top.html "; ', 2000);
SetTimeout (' document.location= ' top.html "; ', 2000);
SetTimeout (' location.href= ' top.html "; ', 2000);
SetTimeout (' Location.replace ("top.html") ', 2000);
Window object
Document Object
Location Object
HREF attribute
1.window.document.location.href
2.window.document.location
3.window.location.href
4.window.location

5.document.location.href
6.document.location
7.location.href
8.window.navigate
9.location.replace
As long as you use the location method, and any Window object, location object, href attribute, you can jump the page////
</script>

<body>
The page will jump after 2 seconds
</body>

Explain:
Location is an object, such as the properties of Document.location and window.location on this page are
Location.hostname = Community.csdn.net
Location.href = http://community.csdn.net/Expert/topic/4033/4033372.xml?temp=2.695864E-02
Location.host = Community.csdn.net
Location.hash =
Location.port =
Location.pathname =/expert/topic/4033/4033372.xml
Location.search =? temp=2.695864e-02
Location.protocol = http:
A visible href is the property of the location, and the category is string.

Window.location.href/replace/reload ()--page jump + replace + Refresh

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.