javascript: document.write function have redefined, how can I recover it

Viewed 52

When I visit some website(such as: https://www.baidu.com) and open browser dev tool, I found they have redefined function "document.write" as:

document.write
//output: ƒ (){}

yes, they have replaced "document.write" with a "blank" function.
So my question is: how can I recover "document.write" to original function?

1 Answers

As per baidu javascript code document.write is rewritten with empty function. In code it's written as document.write = document.writeln = function() {}

document is instance of Document, we can assign Document.prototype.write to document.write it'll update function to its default. Below is the sample code snippet to override function to use it's default standard document.write = Document.prototype.write

Related