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

171
Vistas
Detect user's keyboard shortcut in a chrome extension

I am currently developing a chrome extension. Only, here I am confronted with a problem: I would like my extension to detect when the user performs a keyboard shortcut and that triggers a JS function. For that, my manifest.json file looks like this:

{
  "manifest_version": 3,
  "name": "name",
  "version": "1.0.0",

  "description": "description.",
  "icons":{
    "16": "img/logo16.png",
    "48": "img/logo48.png",
    "128": "img/logo128.png"
  },

  "permissions": [
    "storage",
    "activeTab",
    "scripting"
  ],
  "background": {
    "service_worker": "js/background.js"
  },
  "commands": {
    "Restart App": {
      "suggested_key": {
        "default": "Ctrl+Shift+6",
        "mac": "Command+Shift+6"
      },
      "description": "Restart my app (Debugging)"
    }
  }
}

My background.js file located in the js folder, contains this:

chrome.commands.onCommand.addListener(function (command)
{
    if (command == "Restart App")
    {
        chrome.runtime.reload();
    };
    alert('app restart success !');
});

Only, when I launch the extension and execute the keyboard shortcut, nothing happens, no error is reported.

Would you have any ideas, thank you in advance.

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