Returning the "Overridden" Window Method

If I reset window.alert is some other function, is there a way to restore it without the first “save”?

For instance:

window.alert = function() { }; 

After that, is there a way to restore window.alert () to what it was before? (btw: request only for "predefined" DHTML objects - not for random js objects)

+1
source share
1 answer

You can use delete :

 window.alert = function() { }; delete window.alert; 

Here is a working example .

+2
source

Source: https://habr.com/ru/post/918619/


All Articles