Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
Is there any alternative way to access JavaScript globals that have been shadowed or redefined?

For some unknown reason the name URL in my event handler points to a string value with the current URL of the browser instead of the constructor for an URL object. Trying to call it results in the following error:

Uncaught TypeError: URL is not a constructor

The string URL does not appear anywhere in the loaded document which leads me to believe that it is not redefined anywhere in my program. I have not been able to find anything other that would explain why this phenomena occurs.

So my question for a workaround is: Is it possible to access these global constructors in any other way?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Yes, through the name window, as long as it too hasn't been shadowed or redefined:

let a = new window.URL(location);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda