Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!