Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

193
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda