How to restore console.log on a web page that overwrites it?

Twitters website is doing something like

console.log = function () {}; 

to enable the browsers console.log built-in method in no-op. Is there a way to restore the original function?

+5
source share
1 answer

If they also did not delete it in the prototype, the log method using getPrototypeOf() should work:

 console.log = Object.getPrototypeOf(console).log; 

Since using console.log = function() {} overrides but does not delete the value defined in the prototype, you can remove the override method:

 delete console.log 
+1
source

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


All Articles