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

394
Visualizações
"chrome.runtime.reload is not a function" when trying to livereload my extension runtime

I am building a chrome extension, and have integrated it with livereload-js. It is working, except that the call to chrome.runtime.reload() throws an error that the function reload doesn't exist on the chrome.runtime. This is weird, since the documentation says that this method should be there and when I read the the docs for the reload method it says that this method should be available without any additional permissions needed. If this was removed in Manifest version 3, it hasn't been explained in the docs.

To simplify I have removed most of the code from the app, and am simply trying to get the livereload to work. Here is my manifest.json:

{
    "name": "Cool AF",
    "description": "something cool",
    "version": "1.1",
    "manifest_version": 3,
    "background": {
        "service_worker": "background.js"
    },
    "content_scripts": [
        {
            "matches": ["https://nevermind/*"],
            "css": ["main.css"],
            "js": ["main.js", "livereload.js"]
        }
    ],
    "host_permissions": ["http://localhost:35729/"],
    "permissions": ["storage", "management", "activeTab", "alarms", "background"]
}

The code in livereload.js considers if it is a chrome extension and calls chrome.runtime.reload(), which throws an error. I have removed all other code from the extension besides a console.log that let's me know the extension is loading. Any ideas on how to get the reload function to appear on the chrome.runtime object?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

chrome.runtime.reload isn't available for content scripts.

See documentation for the list of methods available to content scripts; some chrome.runtime methods are, but not all:

runtime:

  • connect
  • getManifest
  • getURL
  • id
  • onConnect
  • onMessage
  • sendMessage

The idiomatic way is to message your background script to request it to perform an operation content scripts aren't allowed to do.

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