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

225
Vistas
Chrome extension stops working on website after perioid of time. (Stopping the connection)

Im new in developing and im developing extension for google chrome, but i have stumbled on issue i cant seem to wrap my head around..

extension works otherwise just as intended but for some websites it stops working after perioid of time.

Error:" Error: The client has been inactive since Mon Jan 10 2022 14:45:38 GMT+0200 (Eastern European Standard Time) and it has exceeded the inactivity timeout of 50000 ms. Stopping the connection. "

Manifestv3.json

{
  "manifest_version": 3,
  "name": "Add html",
  "version": "0.0.01",
  "permissions": [
    "contextMenus", 
    "activeTab", 
    "tabs",
    "clipboardRead",
    "clipboardWrite"
  ],
  "icons":{
    "128": "icon128.png",
    "48": "icon48.png",
    "16": "icon16.png"
  },
  
  "background": {
    "service_worker": "eventpage.js"
    
  },
  "content_scripts": [ {
      "matches": ["<all_urls>"],
      "all_frames": true,
      "match_about_blank": true,
      "js": ["content.js"]
  }],
  "description": "Adds html to highlighted text in textareas (example <b>XXX</b>)"
}

eventpage.js

chrome.runtime.onInstalled.addListener(function() {
    var parent = chrome.contextMenus.create({
        "title": 'parent',
        "contexts": ["selection"],
        "id": "myContextMenuId"
    });
});


chrome.contextMenus.onClicked.addListener((info, tab) => {
    console.log("clikki");
    console.log(info.selectionText);
  if (info.menuItemId.includes('Context')) {
    const text = ("<b>"+info.selectionText+"</b>");
    console.log(text);
    console.log(tab.id);
    chrome.tabs.sendMessage(tab.id, text);
  }
    });

content.js

console.log("Content script is running...");


chrome.runtime.onMessage.addListener(msg => {
    console.log("content.js toimii");
    console.log( msg );
    document.execCommand('insertText', false, msg);
  
});

console.log ("vituiksmen");

chrome.connection.hub.disconnected(function() {
   setTimeout(function() {
       console.log("restart");
       chrome.connection.hub.start();
   }, 5000); // Restart connection after 5 seconds.
});

chrome.connection.hub.disconnected doesent work. Eny suggestion to keep the site active alltho its not visible etc?

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