Difference between window.location.href=window.location.href and window.location.reload()

javascript

Solution

If I remember correctly, `window.location.reload()` reloads the current page with POST data, while `window.location.href=window.location.href` does not include the POST data.

As noted by @W3Max in the comments below, `window.location.href=window.location.href` will not reload the page if there's an anchor (#) in the URL - You must use `window.location.reload()` in this case.

Also, as noted by @Mic below, `window.location.reload()` takes an additional argument `skipCache` so that with using `window.location.reload(true)` the browser will skip the cache and reload the page from the server. `window.location.reload(false)` will do the opposite, and load the page from cache if possible.

Problem

What is the difference between JavaScript's ``` window.location.href = window.location.href ``` and ``` window.location.reload() ``` functions?

Original source

Related problems