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

237
Vistas
How to connect popup script to content script on chrome internal browser pages?

I'm trying to send a message to the content script running on the page in the active tab. This works fine for any normal page. However, when I try to do this for pages starting with chrome:// in the URL I get an error:

Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.

This is the code I'm trying to run:

// popup.js
window.addEventListener('load', (event) => {
    // In case the next line yields chrome://new-tab-page
    // or chrome://extensions for example
    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
        // Request data from app
        chrome.tabs.sendMessage(tabs[0].id, "siteData", function(response) {
            // error!
            // Log app's response
        }
    }
}

//content script (even though it doesn't reach the content script)
// Site Data request
chrome.runtime.onMessage.addListener(
    function(request, sender, sendResponse) {
        if (request === "siteData") {
            sendResponse({siteList: siteList, site: site, hostname: hostname});
        }
    }
);

Is it possible at all to establish a connection with a content script on an internal chrome page? Does the internal page even execute the content script?

Thank you

Edit: This Can you access chrome:// pages from an extension? answered my question.

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