"Turn": http://zccst.iteye.com/blog/2162658
The reload method, which forces the browser to refresh the current page.
Syntax: Location.reload ([Bforceget])
Parameters: Bforceget, optional parameter, default is False, the current page is taken from the client cache. True, the latest page from the server is taken as a GET, equivalent to the client clicking F5 ("Refresh")
The Replace method, which replaces the currently cached item in history (client) by specifying a URL, so you cannot access the URL that has been replaced by "forward" and "back" after using the Replace method.
Syntax: Location.replace (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 Replace function is exactly the same as the HREF attribute or the Assign function of the location when setting the URL, but it removes the URL from the address list of the history object so that functions such as go or back cannot navigate.
Example:
1 < a class = "btn btn-success radius r mr-20" style = "line-height:1.6em;margin-top:3px" href = "Javascript:location.replace (location.href);" title = "Refresh" >< i class = "Hui-iconfont" > </ i ></ a >
View Code
Here are the relevant applications and knowledge points:
Window.location.href
Window.top.location.replace ("Http://www.jb51.net")
Top.location.href ("Http://www.jb51.net")
Window.navigate ("Http://www.jb51.net")
Html:
<meta http-equiv= "Refresh" content= "0; url=http://baidu.com/">
---------------------------------------
URL: Uniform Resource Locator (Uniform Resource Locator, URL)
The complete URL consists of the following parts:
Scheme://host:port/path?query#fragment
Here are the following:
1"" Scheme:
Common Http,ftp,maito of communication protocols, etc.
2 " host: Host
Server (computer) domain Name System (DNS) hostname or IP address. &NBSP
3 " Port: Port number
Integer, optional, omit when using the default port of the scheme, such as HTTP, the default port is 80. &NBSP
4 " path: path
A string separated by 0 or more"/"symbols, typically used to represent a directory or file address on a host. &NBSP
5 " query: Query
Optional, for use with dynamic Web pages such as CGI, ISAPI, php/jsp/asp/asp. NET and other technical Web pages) pass parameters, can have multiple parameters, separated by the "&" symbol, the name and value of each parameter is separated by the "=" symbol. &NBSP
6 " fragment: Message fragment
String that specifies the fragment in the network resource. For example, there are multiple noun interpretations in a Web page, and you can use fragment to navigate directly to a noun interpretation. (also known as anchor points.)
example:
for such a url
http://www.jb51.net:80/ fisker/post/0703/window.location.html?ver=1.0&id=6#imhere
We can use JavaScript to get all the parts
1 , window.location.href
the entire URL string (the full address bar in the browser)
This example returns the value: http://www.jb51.net:80/fisker/post/0703/ window.location.html?ver=1.0&id=6#imhere
2,window.location.protocol
The protocol part of the URL
This example returns the value: http:
3,window.location.host
The host part of the URL
This example returns the value: WWW.JB51.NET&NBSP;
4, window.location.port
The port portion of the URL
If the default port of 80 (update: Even if added: 80), the return value is not the default of 80 but the null character
This example returns a value : "" &NBSP;
5,window.location.pathname
The path portion of the URL (that is, the file address)
This example returns the value:/fisker/post/0703/ window.location.html
6,window.location.search
Query (parameter) section
Besides assigning values to dynamic languages, we can also give static pages, and use JavaScript to get the value of the argument that you believe should be
This example returns the value:? ver=1.0&id=6
7,window.location.hash
Anchor Point
This example returns the value: #imhere
"JS method" JS page refresh Location.reload and location.replace difference "turn"