Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Why doesn't "console.log()" work on this website?

I can open the Chrome DevTools console for this URL: https://www.google.com/ and enter the following command to print "Hello world!" to the console:

console.log("Hello world!")

However, when I attempt to use the same command for this URL: https://svc.mt.gov/dor/property/prc my message isn't printed in the console. Why is that?

Is there any way to force the console to work for this MT website?

I've tried using python/selenium to open the page and execute_script() to issue the command, but that hasn't worked either.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

If you do

console.dir(console.log)

and click on the [[FunctionLocation]], you'll see the following in the site's source code:

"Debug" != e && (window.console.log = function() {}
    )

Seems like a cheap (but lazy?) way to suppress logging on production.

One way to fix it, kinda, would be to use one of the many other console commands. (console.dir, or console.error, if you want)

If you really want the original console.log to work again, the only way to do that would be to run code before the page code runs, so that you can save a reference to the function. For example, with a userscript:

// <metadata block...>
// @grant none
// ==/UserScript==

const origConsoleLog = console.log;
// set original window.console.log back to its original
// after the page loads
setTimeout(() => {
  window.console.log = origConsoleLog;
}, 2000);

// there are more elegant but more complicated approaches too
about 4 years ago · Juan Pablo Isaza Report

0

CertainPerformance already explained how this is possible and what the reason for suppressing the log seems to be. I'm going to show here another method to get back console.log after the original has been lost.

document.body.appendChild(document.createElement('IFRAME')).onload = function () {
    this.contentWindow.console.log('Hello, World!');
    this.remove();
};

This basically uses an old method of restoring global objects from a temporary iframe.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!