Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use location.reload in javascript programming

Shulou Source: shulou.com Published: 2022-06-03 11:01:31 09月22日 Update

This article mainly shows you "how to use location.reload in javascript programming", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use location.reload in javascript programming" this article.

In javascript programming, location.reload is often used to achieve page refresh. _ window.location.reload (true) / / the browser re-requests resources from the server and does not include a cache token in the http request header.

Definition and usage of locationreload

The reload () method is used to refresh the current document.

The reload () method is similar to the refresh page button on your browser.

If the parameter of this method is set to true, it will bypass the cache and re-download the document from the server regardless of the last modification date of the document. This is exactly the same as holding down the Shift key when the user clicks the browser's refresh button.

Browser support

InternetExplorerFirefoxOperaGoogleChromeSafari

All major browsers support the reload () method

Grammar.

Location.reload (forceGet)

Parameters.

Parameter type description

ForceGet Boolean is optional. If the parameter of this method is set to true, it will bypass the cache and re-download the document from the server regardless of the last modification date of the document.

Return value

This method does not return a value

Location.reload () refresh

Location.reload (forcedReload) method is used to refresh the current page.

ForcedReload this parameter is required to be of Boolean type

1. When the value is true, the browser is forced to retrieve the current page resource from the server instead of reading it from the browser's cache

2. When the value is false or the parameter is not passed, the browser may read the current page from the cache.

Example:

_ window.location.href=_window.location.href

_ window.location.reload

After testing, these two sentences can replace location.reload (true) in some cases.

The retry dialog box will not appear to achieve the effect of refreshing.

The above is all the contents of the article "how to use location.reload in javascript programming". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Browsers browsing methods parameters cache pages programming servers services content documents articles buttons effects dates types resources learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Information macOS Shulou Tech Info MariaDB