Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localStorage is null in Chrome Mobile

My error reporting software is catching JS Web Storage (localStorage and sessionStorage) failures that are consistently on Android devices running Chrome mobile. I am not able to reproduce this error on my own Android device.

The specific error is: TypeError: Cannot read property 'setItem' of null which is caught after I attempt to run localStorage.setItem("storageTest","storageTest")

Any ideas or at other experiences with this problem are greatly appreciated.

like image 708
toams7 Avatar asked Oct 20 '25 12:10

toams7


1 Answers

i think you need to enable dom storage in your android application

WebSettings settings = webView.getSettings();
settings.setDomStorageEnabled(true);
like image 160
Anil Shrestha Avatar answered Oct 23 '25 03:10

Anil Shrestha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!