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

140
Visualizações
How to load vuejs script in a firefox sidebar extension and not get Content Security Policy error?

I'm strung to rewrite my first firefox extension using vueJS.

The manifestio.json

{
    "manifest_version": 2,
    "name": "vuejs note taking",
    "version": "1.0",
    "description": "Tracks your browsing time on any given domain",
    "browser_specific_settings": {
        "gecko": {
            "id": "xxxxx@gmail.com"
        }
    },
    "browser_action": {
        "default_icon": {
            "16": "icon.png",
            "32": "icon.png"
        },
        "default_title": "Open Sidebar"
    },
   ....
    "sidebar_action": {
        "default_icon": "icon.png",
        "default_title": "Theme integrated sidebar",
        "default_panel": "sidebar/index.html",
        "open_at_install": false
    }
}

In background.js

browser.browserAction.onClicked.addListener(async () => {
    await browser.tabs.create({ url: 'sidebar/index.html' }); 
});

and then the sidebar/index.js

<!DOCTYPE html>
<html>
<head>
    <title>Vue</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="index.css"/>
</head>
<body>
    <div id="app">{{msg}}</div>
    <script src="/sidebar/myscripts/vuejs-lib.js"></script>
    <script src="/sidebar/myscripts/main.js"></script>
</body>
</html>

(Through experiments I had to start from root src="/sidebar/..)

The code works, I tried running it on a server. But when I run it in firefix (with web-ext run) I get the error of

Content Security Policy: The page's settings blocked the loading of a resource at eval ("script-src").
about 4 years ago · Juan Pablo Isaza
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