1 Window.prototype.orginalEventListener = Window.prototype.addEventListener; 2 Window.prototype.addEventListener = function(type, listener, useCapture) { 3 if (type !== "beforeunload") { 4 orginalEventListener(type, listener, useCapture); 5 } 6 } 7