Javascript function without any code in it -


i found following javascript code snippet part of popup window, causing browser ask if want close window.

window.onbeforeunload = function() {     settimeout(function() {         window.onbeforeunload = function() {};         settimeout(function() {             document.location.href = 'index.html';         }, 500);     },5);     return ''; }; 

i wondering these things:

  • why use function without code in ( code line 3 )
  • why use window.onbeforeunload inside second time?

or try obfuscate purpose ?


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -