Is $window.location.reload(true) The Equivalent Of Ctrl+f5?
I am attempting to build a 'version updated' component that will show a banner when the website has been updated and prompt a user to reload. Unfortunately when some users reload t
Solution 1:
According to MDN the forcedReload
parameter in window.location.reload
, when set to true
:
... causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.
Solution 2:
No it's not (proven by testing)
The main difference: Ctrl-F5
will cause all the attached resources also to reload (scripts, images ...) while the reload(true)
will not, the main page (html) will be requested but resources can still be loaded from cache
Solution 3:
Did you try something like:
$window.location.href = currentUrl + '?' + newDate().getTime();
That should force a cold refresh.
Post a Comment for "Is $window.location.reload(true) The Equivalent Of Ctrl+f5?"