I'm developing an app using CORDOVA and I am using localstorage in javascript
Can I use Cordova to access local storage in webview directly?
I looked at the documentation on the https://cordova.apache.org/docs/en/latest/ but couldn't find it.
Javascript code -
window.localStorage.setItem("test", "hello World");
ios native code - I want
get("test");
yes it works on ios in javascript, to get the value :
window.localStorage.getItem("test");
more from cordova docs https://cordova.apache.org/docs/fr/latest/cordova/storage/localstorage/localstorage.html :
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady() {
window.localStorage.setItem("key", "value");
var keyname = window.localStorage.key(i);
// keyname is now equal to "key"
var value = window.localStorage.getItem("key");
// value is now equal to "value"
window.localStorage.removeItem("key");
window.localStorage.setItem("key2", "value2");
window.localStorage.clear();
// localStorage is now empty
}
to read :
https://github.com/react-native-community/react-native-webview/issues/73
How to set the local storage before a UIWebView loading its initial request?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.