Replacing JS files on page. Load the page ignoring the hash
!firstLoad === '1'
is always false
if document was loaded from hash
And what does that mean? You mean cache maybe?
You mean cache maybe?
Maybe.
!firstLoad === '1' is always false
indeed
I recently created a script that replaces any JS file on the site (https://greasyfork.org/ru/scripts/437488-easy-script-replacement-example). But sometimes it may not work if the document is loaded from the hash. I solve this problem this way, but I'm not sure about this solution and it doesn't seem stable to me.
// if document was loaded from hash HTML may not be replaced
var firstLoad = localStorage.getItem('firstLoad');
if (!firstLoad === '1') {
....localStorage.setItem('firstLoad', '1');
....// reloading with hash ignoring
....return window.location.reload(true)
} else {
....localStorage.removeItem(firstLoad);
}