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

315
Visualizações
chrome extension content script setTimeout throws error Blocked a frame with origin "X" from accessing a cross-origin frame

Chrome extension content script.

I am loading Jquery in the content script as following (the jquery file is contained within the extension pacakge):

"content_scripts": [
    {
        "matches": [
            "http://*/*",
            "https://*/*"
        ],
        "js": ["lib/jquery-3.6.0.min.js", "content.js"],
        "run_at": "document_idle"
    }]

I then try to run the following code in the content script (content.js):

    setTimeout(() => {
       $("span").each((el) => {
           console.log("****", $(this).text());
       })
    }, 2000)

Which ends with chrome throwing the following error:

DOMException: Blocked a frame with origin "https://" from accessing a cross-origin frame.

The weird thing is that if I dont use $(this) there is no problem. so for example the following would work fine without errors:

setTimeout(() => {
    $("span").text("asdasdasd");
}, 2000)

What am I missing here? I dont get the reasoning behind this and its driving me mad...

about 4 years ago · Juan Pablo Isaza
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