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

147
Visualizações
Chrome addons (plugins) javascript files seem isolated

I have created an unpacked plugin for Chrome (that also works in Firefox), that has a single script.js file. And it works.

However, trying to call a function included in the addon's script.js file from the console results in:

Uncaught ReferenceError: _islet_convert is not defined
at <anonymous>:1:1

(anonymous) @ VM259:1

Which by the way I tested just to verify with not_a_function() in the console, and the error was the same.

Can someone tell me how Chrome and probably Firefox handles or isolates the JavaScript in the content_scripts files? And if there is any way to reference a function/method in the file.

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

0

From the documentation in Chrome:

https://developer.chrome.com/docs/extensions/mv2/content_scripts/

Content scripts live in an isolated world, allowing a content script to makes changes to its JavaScript environment without conflicting with the page or additional content scripts.

...

Isolated worlds do not allow for content scripts, the extension, and the web page to access any variables or functions created by the others. This also gives content scripts the ability to enable functionality that should not be accessible to the web page.

Essentially, it appears any communication needs to happen through the DOM including adding event listeners.

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