I'm using localStorage.setItem() for setting the data in the localstorage of my browser
but I don't know what is happening in my android browser the data is not getting saved in localstorage
localStorage.setItem("mytime", Date.now());
Yeah. The mobile browser also has localStorage & sessionStorage. Check Mozilla docs
Refer Can I Use? too...
If your data is not getting stored in localStorage of mobile devices. You could debug mobile devices by
Android -remote debugging.
iOS - remote web inspector
Related
I am currently working on an Ionic2 app. I am using IndexedDB for data storage. I want to view IndexedDB on Safari developer tools.
Is it possible just like in Chrome?
To view the contents of the IndexedDB you need to hit the refresh button at the top right of the dev tools.
Recently I adopted cordova's crosswalk plugin to ensure a uniform and performant HTML5 environment across android devices. Everything was working fine until I deploy the application. That's when I noticed that all existing settings from the native browser, which was being used by the cordova webview were gone! Our localStorage was now in a different browser - the chromium browser which is served by crosswalk project.
Now I'm asking myself what will happen if the crosswalk project updates it's internal browser to a new chromium browser version? Will I lose the localStorage data once again?
Here are some references that I had look at while researching into the subject:
Crosswalk storage limits
Scope of sessionStorage and localStorage
Where the sessionStorage and localStorage stored?
Probably yes, you will lose the data. Also updating the device SO can cause the loss of data. I had the same problem. You should consider to use sqlite database to persist permanently your data.
The issue that was concerning this subject was closed last week. "Not able to migrate the existing webview data (localstorage/websql) to crosswalk"
Check it out here: https://crosswalk-project.org/jira/browse/XWALK-7368
I am building a Cordova app with the Ionic Framework. I am using angular-localForage as the local database for the app's persistent storage.
While developing, I am testing my app using Google Chrome 45.0.2454.85 m on Windows 10. angular-localForage is at version 1.2.3 and localForage is version 1.2.4.
I can set and retrieve data no problem. To set data I am using:
$localForage.setItem(myKey, myData).then(myCallbackFunction);
According to the docs, localForage should use IndexedDB if it's available and fall back to WebSQL for browsers where it is not available. I can see from looking at Resources in Chrome Developer tools that it is storing my data in WebSQL.
If I put this code in my controller I get a message saying IndexedDB is available:
if (!window.indexedDB) {
window.alert("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available.");
} else {
window.alert("IndexedDB available.");
}
My question is, why is it using WebSQL in Chrome when I have IndexedDB available?
The problem is actually quite sneaky.
TLDR; Apple's UIWebView doesn't support indexedDB. Turn off Chrome's iOS emulator to see indexedDB working.
What's happening is that I'm assuming you're emulating an iPhone with Chrome dev tools. Well, this spoofing is actually really effective because localForage will now emit an error if you configured it to exclusively use indexedDB.
If you want to have a moment of profound ennui and see indexedDB in action... turn off emulation so that you're using Chrome's own user-agent. It'll work then.
Source: I had to deal with this nonsense myself. It was a really bad developer experience. HAH.
My guess is that websql is taken as first choice since it exists longer than the indexeddb api and chrome was pushing websql earlier than indexeddb. Since chrome still supports websql it takes websql before indexeddb.
I am making a jQuery Mobile and PhoneGap app.
I am about to save some data to local storage. I am wondering if it is safe on mobile browsers (Android, iOS and windows). On PC I am able to check the values in FireBug. Is it possible somehow on mobile devices? Can I access in app A data specified by app B?
Thanks for help.
At least in iOS, if it's a phonegap app the localStorage is only accesible from the app.
To check values while you are developing, you can try debug phonegap.(only works on webkit browsers). If you put a name there, it creates a script tag to include in your index. If you include that script tag in your index and execute the app you can see a remote web inspector for your app.
I am using localStorage in jQM and PhoneGap. If I don't delete localStorage manually, how long would it be stored? When it is deleted?
I would like to know how it works on mobile devices running Android and iOS. I found an opinion that iOS browser clears it occasionally, is that true?
The localstorage is persistent. It will be stored until you uninstall the application or clear it manually.