简体   繁体   中英

html5 SessionStorage doesn't work in android emulator

i have a hybrid android app built with html5 , javascript jquery and css .. I've made a simple code that store for me a value using the sessionStorage . that function declared in the javascript only and it works fine in the ordinary browser , but in the android emulator it doesn't work .. this is the simple code in JS:

id = document.codeform.ID.value;

var elmtId = document.getElementById("IDe");
elmtId.innerHTML = id ;

sessionStorage.idL = id ; 
alert (sessionStorage.idL);

do i need to add something in the manifest file or in the my class ?

We must add the following instruction to our webview so the webstorage will be allowed in the android browser :

browser.getSettings().setJavaScriptEnabled(true);
        browser.getSettings().setDatabaseEnabled(true);
        browser.getSettings().setDomStorageEnabled(true);
       browser.getSettings().setAllowUniversalAccessFromFileURLs(true);
        browser.getSettings().setAllowContentAccess(true);
        browser.setWebChromeClient(new WebChromeClient());

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM