Use js to refresh the concrete implementation of the current page reserved parameters

  • 2020-03-30 01:02:49
  • OfStack

Had certain site traffic, you need to find a way to improve the viscosity, the world buyers net recently going to get a set of tools of foreign trade, is some commonly used tools, such as world time query, hscode query, query and exchange rate conversion, etc., there are a few have been completed, you see, for advice. There's also the refresh of js, which is not very good, so I'm going to record,

The reload method, which forces the browser to refresh the current page.
Grammar: location. Reload ([bForceGet])
Parameter: bForceGet, optional parameter, false by default, takes the current page from the client cache. True, then GET the latest page from the server, which is equivalent to the client clicking F5(" refresh ").

The replace method replaces the current cached (client) item by specifying a URL, so when using the replace method, you cannot "forward" or "backward" the URL that has been replaced.
Grammar: the location. The replace (URL)

In practice, when you're reloading a page, you usually use location.reload() or history.go(0). Because this is like the client endpoint F5 refreshing the page, the page method="post" will prompt "page expired." That's because of the Session security mechanism. As you can imagine, when the location.reload() method is called, the aspx page is already in server memory and must therefore be IsPostback. If there is an application where we need to reload the page, which means we expect the page to be re-created on the server, we expect it to be Not IsPostback. In this case, location.replace() does the job. The replaced page is regenerated each time on the server.

You could write: location.replace(location.href);

Related articles: