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

111
Vistas
Unable to share Local-Storage context into the same Web App

I'm developing my first Web-App that will be embedded into an Android Web-View. The App is entirely done using standard HTML and JavaScript, with no special requirements nor libraries, only jQuery is used).

The first time the App is opened, the content to be displayed is downloaded using Ajax and saved to LocalStorage, so it can be accessed offline. When the application is uploaded to a web server (ex: myserver.com), LocalStorage works perfectly, this is, that I save a string in one page:

localStorage.setItem("MYVAR", "Hello World!");

and it is accessible from other html pages:

console.log(localStorage.getItem("MYVAR"));

But when the App is opened directly in the browser (local browsing using file://), to emulate the bahaviour of a Web-View, then it seems that the context for LocalStorage is lost, being different on each page, so LocalStorage is not shared and when a variable is created in one page, is not visible in other pages (but when uploaded to a server everything works fine).

For accessing remote files through Ajax and avoid issues in running JS files, I'm using this:

<meta http-equiv="Content-Security-Policy" content="script-src 'strict-dynamic' 'nonce-ABCD0123456'" />
<script nonce="ABCD0123456" src="myscript.js"></script>

I'm not sure whether this is related to Security policies, manifest settings, but I'm pretty sure that I'm missing something.

Any help will be much appreciated.

about 4 years ago · Santiago Trujillo
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