I'm using a third party script (Adobe DTM, useful to tag management purposes) on my pages, and it is causing the following problem:
I noticed that my pages are being reloaded right after being fully loaded for the first time (in the next load, it doesn't occur anymore), and the blame is on this function, present at one of the scripts loaded by the DTM tag in my HTML.
function Ne(Oe, Gc, nc, Ic) {
if (Oe.targetJSLoaded) {
return;
}
Ic.setCookie(Gc, true, nc);
window.location.reload(); //in the first page load, this line is always executed
}
It's pretty hard to figure out what is going on the script, once it has more than 5000 lines and it's obfuscated.
I need to prevent that window.location.reload() from being executed, but i have the following problems:
- Once is a third party loaded script (the script tag points to an URL which loads a bunch of other scripts during page load), i can't edit it manually.
- I can't break the user from reloading the page manually via F5.
I've tried something with the following jQuery code, but it doesn't work:
$(window).bind("beforeunload",function(e){
e.preventDefault();
});
Is there a form to prevent that programatic reload, considering the situations described?