I recently created a script that replaces any JS file on the site (https://greatest.deepsurf.us/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); }
I recently created a script that replaces any JS file on the site (https://greatest.deepsurf.us/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);
}