简体   繁体   中英

Window.Locaton.reload() behaves differently in different browsers (fire fox , Chrome)

I am quite new to JavaScript, I have written some code that just reloads the page

window.location.reload()

When I run the application in Firefox it re-posts the form and when I run the application in Chrome it redirects to another page.

What are the mechanism of the browsers (Firefox, Chrome) when the page is reloaded using window.location.reload() ?

According to w3school. The reload() method does the same as the reload button in your browser

syntax is

location.reload(forceGet)

forceGet is optional. default false which reloads the page from the cache. Set this paramter to true if you want to force the browser to get the page from the server

also you can use href for reload the page.

window.location.href="";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM