reload method, which forces the browser to refresh the current page. Syntax: locatio{filter}n.reload([bForceGet]) Parameter: bForceGet, optional parameter, defaults to false, fetches the current page from the client cache. true, then the latest page is retrieved from the server in the GET method, which is equivalent to the client clicking F5 ("Refresh").
replace method, which replaces the item currently cached in history (client) by specifying a URL, so when using the replace method, you cannot access the replaced URL by "forward" and "backward". Syntax: locatio{filter}n.replace(URL) In practice, when refreshing the page, we usually use locatio{filter}n.reload() or history.go(0) to do it. Because this practice is like the client clicking F5 to refresh the page, when the page's method="post", a "page expired" prompt will appear. That's because of Session's security protection mechanism. You can think of it as when you call the locatio{filter}n.reload() method, the aspx page already exists in the server's 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 recreated on the server side, and we expect it to be not postbacked. Here, locatio{filter}n.replace() can do this. The replaced page is regenerated on the server side every time. You can write it like this: locatio{filter}n.replace(locatio{filter}n.href)
The replace function is exactly the same as locatio{filter}n's href attribute or assign function in setting the URL, but it removes the URL from the address list of the history object, making functions like go or back unnavigable. |