0
votes

I have a WP8 HTML/JS app and I need to save some simple data on the local storage. It should be something very easy, but it is giving my a headache already.

I tried to call the localStorage in many different ways but it doesn't work. The error message I get is: The system cannot find the file specified.

The strange part, is that the sessionStorage seems to be fine. At least I don't get any error using that object.

Additional info: - The ways I called localStorage are: localStorage.setItem(), window['localStorage'], window.localStorage, etc. they all say the same message. - I am developing a Windows Phone HTML app OS8. - The method I call the localStorage is in $('#channels').bind('pagebeforeshow', function (e, data) {...} - The only references in the project are .Net for Windows Phone and Windows Phone. - Some of the js libs I included are jQuery, jQuery mobile and ko. - I am testing on both WP8 device and Emulator

I prefer not to use phoneGap and any other known db for devices, since I wouldn't like to involve interaction with the native code just to make the call to fetch and save some data.

UPDATE 1: After thefrontender comment, I investigated one by one my js refs. The problem appear when I add the jqm 1.3 min. All js are bundled with my app. Any other suggestions?

$(function () {
        try {
            localStorage.setItem('aaa', 123);
            alert(localStorage.aaa);
        }
        catch (err) { alert(err.message) }
    });
2
issues.apache.org/jira/browse/CB-2427 Are all your JS assets bundled with the app or are you linking them in from the web?thefrontender
all js are bundled with my app. Well, you made me wonder so I investigated one by one my js refs. The problem appear when I add the jqm 1.3 min. <script src="js/jquery.mobile-1.3.0.min.js" type="text/javascript"></script> Any suggestion?Yiannis Stavrianos

2 Answers

1
votes

And if you replace

alert(localStorage.aaa);

with

alert(localStorage.getItem('aaa');
0
votes

I got my answer form jQuery official forum after all. You need to add modernizr with atleast localStorage from HTML5 section.

Add: (first or last doent matter)

as indicated in the following post too: http://www.pksoftlab.com/?p=1073