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

210
Vistas
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 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