Failing storage tests on IE for Windows Phone 7 #17

Closed
sunpig opened this Issue Jun 24, 2011 · 7 comments

Projects

None yet

3 participants

@sunpig
sunpig commented Jun 24, 2011

The storage tests fail for me in IE on Windows Phone 7 (device: LG Optimus 7). I've done a bit of digging, and the problem seems to be with the #userData behavior:

    var div = document.createElement( "div" ),
        attrKey = "amplify";
        div.style.display = "none";
        document.getElementsByTagName( "head" )[ 0 ].appendChild( div );
        if ( div.addBehavior ) {
            div.addBehavior( "#default#userdata" );
            // All good so far
        }

It all works up to this point. (div.addBehavior) evaluates true, and no error is thrown when adding the behavior to the div. However, when you try to load something through the div, I get an error "Object doesn't support this property or method".

            div.load( attrKey ); // Throws error

I've spent some time googling for possibilities, but I can't see anything like this reported elsewhere.

@sunpig
sunpig commented Jun 24, 2011

Minimal test case for userData storage here: http://jsbin.com/urepoq/edit

@sunpig
sunpig commented Jun 24, 2011

The PDF "Designing Web Sites for Phone Browsers" (http://create.msdn.com/en-US/education/catalog/article/Designing_Web_Sites_for_Phone_Browsers) by the IE Team at Microsoft has as its very last sentence: "Additionally Internet Explorer Mobile does not support DHTML or binary behaviors."

IE Mobile on WP7 also does not support HTML5 localStorage. (It is likewise difficult to find concrete information about this. I ran html5test.com on my WP7 device, and it says that localStorage is not available.)

This kind of cuts down on the options for now. IE9, when it lands, should be better.

@scottgonzalez
Contributor

Hey @sunpig thanks for all the details. I'm hoping to get a Windows Phone 7 soon so that I can debug this and a few other issues. It doesn't seem to be a very good web device and I can't debug it right now :-(

@sunpig
sunpig commented Jun 27, 2011

I've actually been pretty impressed by the loading & rendering speed of IE7 on WP7 when browsing ordinary web sites, so long as you don't mind having to zoom and scroll all the time. But as a platform for delivering "web apps" (let alone "mobile web apps") it's...sub-optimal.

@AdamYoung

I am also having this issue where IE on WP7 fails.
There are 2 errors that I see happening div.load( attrKey ) and div.save( attrKey ) in the userData section
I was able to get around this by adding the load and save checks to the addBehaviour check
From:
if ( div.addBehavior ) {
To:
if ( div.addBehavior && div.load && div.save ) {

It won't make local storage work on WP7 but will prevent the errors and allow it to use 'memory' for storage.
This should still allow other older IE versions to take advantage of userData.

@scottgonzalez
Contributor

@AdamYoung, this doesn't work for two reasons. 1) You can't detect on div.load, you have to use "load" in div. 2) The load method doesn't exist until the behavior is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment