The main difference is as follows:
window.location.reload () reloads the current page with POST
data, and window.location.href = 'your url' does not include POST
data.
In addition, window.location.reload(true)
reloads the page from the server. And the browser will skip the cache.
For example, I see that you are using the success
function from an AJAX
request.
Suppose you follow the method:
[OutputCache(Duration=600)] public ActionResult Homepage(){
If you use window.location.href="location_URL"
, then the browser cache data is 600
seconds, which means 10 minutes.
On the other hand, if you use window.location.reload(true)
, then the browser will skip the cache and reload the page from the server.
source share