Rakesh Shetty Rakesh Shetty - 4 months ago 19
Android Question

window.localStorage.setItem not working on mobile phone

I am working on HTML5 mobile app using jQuery mobile.

This is my code:


var mobile = $('#mobile_number').val();
var user_id = sessionStorage.getItem("user_id");


url: BASE_URL+'users/send_sms_code.php',
type: 'POST',
datatype: 'json',
data: "user_id="+user_id+"&mobile="+mobile+"&type=1",
success: function (response) {
var data = jQuery.parseJSON(response);

if(data.status == 'Fail') {
$('.very_mob_no_message').html('Sorry some error occurred,try again.');

}, 500);





window.localStorage.setItem("mobile",mobile); // IT IS NOT WORKING

$('.very_mobile_message').html('Enter code which is <br/> sent to your mobile number.');


error: function (jqXHR, textStatus, errorThrown) {



I want to store mobile number in session using
. It is working when I run on my browser but when I runt on mobile phone as APP it stop working. Why this happening. I am checking android phone.


So finally found the solution, I need to set webSettings.setDomStorageEnabled(true); on android code and after this localstorage is working perfectlly.