Overwriting document.open creates a variable / function called open directly on the document object. However, the original function was not on the object itself, but on its prototype, so you can really restore it.
The open function is from HTMLDocument.prototype , so you can access it using HTMLDocument.prototype.open .
To call it directly, use .call() to specify the object to use it:
HTMLDocument.prototype.open.call(document, ...);
You can also restore document.open by simply assigning it:
document.open = HTMLDocument.prototype.open;
However, remember that HTMLDocument and therefore document are HTMLDocument objects, and it's usually a good idea not to bother with them - especially in IE, things are likely to be elusive if you do.
source share