Q:

Can I re-enable Window.alert after override?

If I have a page overriding window.alert box:
Window.alert = function() {}

can I re-enable the alert box if I have access to the Javascript?

A:

I guess I would save the original alert function off somewhere else and then reassign it back to it.

var originalAlert = window.alert;

window.alert = function(stuff) {
  console.log('alert invoked');
}

alert(); // displays a message in the console

var newWindow = window.open();

window.alert = newWindow.alert;

newWindow.close();

alert(); // alerts a message

I don't know that I would open a new window just to get the alert function, but that function is native code, so once it's been closed over, you can't get it back without some crazy hack like this. At least not that I'm aware of.

