I found the following javascript code snippet as part of a popup window, which is causing my browser to ask if I really want to close the window.
window.onbeforeunload = function() {
setTimeout(function() {
window.onbeforeunload = function() {};
setTimeout(function() {
document.location.href = 'index.html';
}, 500);
},5);
return '';
};
I am wondering about these things:
- why would you use a function without any code in it ( code line 3 )
- why do you use window.onbeforeunload inside itself a second time?
Or does this just try to obfuscate its purpose ?
Aucun commentaire:
Enregistrer un commentaire