I am making a Windows 8 Phone app using HTML 5.
I am using localStorage for saving some small values as shown in the code below, I have tested my code in all browsers and it was working perfectly fine, then I created a new HTML 5 project and added my code to the project and ran the application.
In the following code, I suspect that localStorage here is not working and I wonder why ?? !
$("#cow_btn").click(function(){
localStorage.selected_category = "cow";
window.location.href = 'animals.html';
});
How did I come to this conclusion ?
1 - I tried giving alerts before and after the localStorage.selected_category = "cow"; line, here the first alert was shown but the second alert was not shown.
$("#cow_btn").click(function(){
alert("hello1");
localStorage.selected_category = "cow";
alert("hello1");
window.location.href = 'animals.html';
});
2 - Next I tried removing the line itself and then my window.location.href = 'animals.html';which was not working earlier now worked.
$("#cow_btn").click(function(){
window.location.href = 'animals.html';
});
What could be the problem here ? My entire app works smoothly with Firefox, Chrome and even with Internet Explorer 10.
Please share your thoughts on this. How do I make the localStorage work on my HTML 5 Windows 8 Phone app ?
NOTE:
I am using the following js - jquery.min.js & jquery.mobile-1.2.0.min.js