Note that there are some explanatory texts on larger screens.

plurals
  1. POWebOS Resets LocalStorage On Browser Close?
    primarykey
    data
    text
    <p>I have an HTML5 webapp wherein I use localStorage to retain some client-side user settings between uses. I thought I had it all working well, but I recently find that in the WebOS browser the localStorage items are cleared after the browser is completely closed (all cards--not just my page). It is acting like it is saved to session storage, but that is not the case. Here is a minimal example that illustrates my problem:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;meta charset="utf-8" /&gt; &lt;meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;script type="text/javascript" src="js/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; $(function() { $('#btnV').click(function() { var x = ''; for(var i = 0; i &lt; localStorage.length; i++) { x += localStorage.key(i) + ':' + localStorage.getItem(localStorage.key(i)) + '&lt;br/&gt;'; } $('#lbl').empty().append(x); }); $('#btnS').click(function() { localStorage.setItem('test', 'blah'); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;span id="lbl"&gt;&lt;/span&gt; &lt;input type="button" id="btnS" value="Save" /&gt; &lt;input type="button" id="btnV" value="View" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When I first load the page and click the "View" button, nothing is shown. If I click "Save" and then "View" I will see the item as saved. Refreshing the page and clicking View immediately shows the value is retained across page-reload. However, if I completely close out the browser and then go back in to the page, "View" will show no values as it did the very first time. Am I setting localStorage items incorrectly, or is my WebOS browser configured somehow to do this? I couldn't find anything relevant in the settings.</p> <p>Thanks...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload