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

163
Vistas
Storing items into a list from the values fetched by background script

I am new to extensions. my extension's purpose is to save the URLs of all tabs ever opened on the browser. This is my background script so far:

var URLs = [];
chrome.history.onVisited.addListener(storeURL);
chrome.storage.onChanged.addListener(function (changes, namespace) {
    for (let [URL, { oldValue, newValue }] of Object.entries(changes)) {
        URLs[URLs.length] = newValue;
    }
});

function storeURL(HistoryItem) {
    console.log("entered in storeURL function", HistoryItem)
    chrome.storage.sync.set({ URL: HistoryItem?.url }, function () {
        console.log('URL is set to ' + HistoryItem?.url);
    });
}

The problem is that i am able to access the current url in developer tools but its not being stored in URLs. Note: I want the extension to be autonomous and not popup. my manifest.json:

{ 
    "name": "URL tracker",
    "version": "0.0.1",
    "manifest_version": 3,
    "description": "Stores the browser URLs",
    "action": {
        "default_popup": "url.html",
        "default_icon": "logo-small.png"
    },
    "background": {
        "service_worker": "background.js"
    },
    "content_scripts": [
        {
            "matches": ["<all_urls>"],
            "css": [],
            "js": ["content.js"]
        }
    ],
    "icons": {
        "128": "logo-small.png",
        "512": "logo-small-2.png"
    },
    "permissions": [
        "history",
        "tabs",
        "activeTab",
        "storage"
    ]
}
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