1

I'm debugging a website in Chrome's developer tools (F12) and the website's programmers have reimplemented console.log for their own purposes. In their code they've basically done this:

`console.log = function () { new code that has nothing to do with logging to console }`

When I call console.log it doesn't log to console.

My question is - how do I call the original console.log that the browser implements and not the overridden version?

I don't have access to website's code or its programmers.

bodacydo
  • 75,521
  • 93
  • 229
  • 319

1 Answers1

2

Do you need the old implementation??

if not the most simple is to delete that old implementation

delete console.log;

It will automatically revert to default operation.

kirie
  • 342
  • 2
  • 11
  • It worked! I dont need the old implementation. Thanks so much! – bodacydo Oct 13 '15 at 12:06
  • Hey the OP is actually trying to get the old method.. not the overridden one.. So I do not see a point of this +1 vote here.. Who ever it was.. Please check – Akshay Khandelwal Oct 13 '15 at 12:06
  • This answer does not work in Firefox 40, delete console.log removes everything as there is no prototype log method where to fallback. Actually `console.__proto__.constructor===Object` – Pablo Lozano Oct 13 '15 at 12:21
  • @Pablo I'm using 40.0.3 and it works fine, if it doesn't work I think it is bugs in Firefox. – kirie Oct 14 '15 at 04:38