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

218
Visualizações
Chrome refuses to run html script in a chrome extension

I'm trying to make a chrome extension that stores text locally using the chrome.storage API as a sort of password manager. (I know chrome has one built-in but this is just for practice) But chrome refuses to run the script that runs when the form for the text is submitted.

HTML:

<!DOCTYPE html>
<html lang="en">
  <head>
    <style>
      text {
        font-size: 30px;
      }
    </style>
  </head>
  <body>
    <div class="text">
      <p>Totally 100% secure password manager</p>
    </div>

    <form action="post" autocomplete="off" id="Form">
      <input type="text" name="password" id="Text" />
    </form>
    <script>
      //Executes when the html form is submitted
      document.getElementById("Form").addEventListener("submit", function () {
        chrome.storage.local.set(
          { password: document.getElementById("Text").value },
          function () {
            console.log(
              "Password stored: " + document.getElementById("Text").value
            );
          }
        );
      });
    </script>
  </body>
</html>

Chrome gives the error "Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-72rWUAkaANWFYjYfF6GlHKHpaIoOaw6UP63fa2/0VAQ='), or a nonce ('nonce-...') is required to enable inline execution.". I'm new to developing in both HTML and javascript so help would be appreciated.

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