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

207
Visualizações
Chrome Extension chrome.runtime.onMessage event not working when blur event is triggered on page

I am sending a message on foreground.js via background.js with the following codes, but only messages are tracked when on the page. Messages are not overlapped when you switch to another tab or become blurred. Can you please help?

Background.js

  chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {

        chrome.tabs.sendMessage(tabs[0].id, { greeting: "hello" }, function (response) {
            console.log(response);
        });


    });

Foreground.js

 chrome.runtime.onMessage.addListener(function(request, sender, sendResponse){
        console.log(request, sender, sendResponse);
        console.log("tıklandı")
        sendResponse({"test":"ok"});
    });

enter image description here The "clicked" text in the picture is written when the message event is triggered. When I click on another area of ​​the page, I cannot send or receive messages.

about 4 years ago · Santiago Trujillo
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