Use js to refresh the specific implementation of the current page retention parameter _ javascript skills

Source: Internet
Author: User
This article describes in detail how to use js to refresh the current page retention parameters. Below is a good implementation, you can see that after the website has a certain amount of traffic, you need to find a way to improve the website's stickiness. The world's buyer network recently plans to get a set of foreign trade tools, which are commonly used tools, such as World Time query. Among them, there is also a js refresh, which is not very easy to get, so record,

Reload method, which forces the browser to refresh the current page.
Syntax: location. reload ([bForceGet])
Parameter: bForceGet. An optional parameter. The default value is false. The current page is retrieved from the client cache. True, the GET method is used to obtain the latest page from the server, which is equivalent to clicking F5 ("refresh") on the client ")

Replace method. This method replaces the items currently cached in the History (client) by specifying the URL. Therefore, after using the replace method, you cannot access the replaced URL by "Forward" or "backward.
Syntax: location. replace (URL)

When refresh the page in practice, we usually use location. reload () or history. go (0. This method is like refreshing the page by pressing F5 on the client. When the method = "post" is displayed, the prompt "webpage expired" appears. This is because of the security protection mechanism of the Session. It can be thought of: when the location. reload () method is called, The aspx page already exists in the server memory, so it must be IsPostback. If there is such an application: we need to re-load the page, that is, 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 page to be replaced is generated on the server every time.

This can be written as follows: location. replace (location. href );
Related Article

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.