JavaScript Localstorage Object Broken in Ie11 on Windows 7

JavaScript localStorage object broken in IE11 on Windows 7

Turns out this is a problem in the base version of IE11 (11.0.9600.16428) for Windows 7 SP1.

After installing a patch to update to 11.0.9600.16476 (update version 11.0.2 - KB2898785) the issue gets resolved. Links to other versions of Windows (32-bit etc.) can be found at the bottom of the patch download page.

localstorage on Internet Explorer not working

Adding the doctype declaration means your mark-up is resolved by the browser the way it should (i.e. as HTML5).

Internet Explorer has a couple of issues with local storage. First of all, it doesn't work at all in versions prior to 8 -- you don't specify the version you're running in your post.

Important: you mention you are running on your C: drive: does this mean you are using the file:// protocol rather than http? if so, problem solved. Using the file protocol will cause various issues, not least that localStorage simply won't work in IE.

If you're still having issues, you may find you need to tinker with the browser's security settings to allow local storage.

This page includes a matrix detailing localStorage support in the various browsers:

http://www.html5rocks.com/en/features/storage

Be sure to check out Mark Pilgrim's excellent HTML5 resource, which includes some IE-specific code for detecting the storage event:

http://diveintohtml5.info/storage.html

using localStorage.setItem Internet explorer

  • Please check this option in IE 11, if this option is disabled, storage object will be undefined in IE:

    1. Click the "Tools" menu and choose "Internet Options".
    2. Click on the tab labeled "Advanced".
    3. Check the box for "Enable DOM Storage".
    4. Click "Apply", click "OK".

Sample Image

  • localstorage can't work with file:// protocal, you need to run the page through http protocal.
  • There might be issues with localstorage in old version of IE 11 in win7/win8, please make sure you have installed the latest update.

localStorage in win8.1 IE11 does not synchronize

I've found a workaround for this issue on Win 10. If you handle the window.onstorage event in your code then localStorage will refresh for all open tabs.
Something as simple as this worked for me:

window.onstorage = function(e){
//Leave this empty
//or add code to handle
//the event
};

I haven't tested this code thoroughly, so please do so before using this method in any production apps.

Hope this helps!

window.sessionStorage issue in IE, when webpage is not run on localhost

I found my answer on: Local website renders differently using (IP address or machine name) vs localhost?

Turns out, that the issue was with my html, not my javascript. I added this line in my head tag:

<meta http-equiv="X-UA-Compatible" content="IE=11">

and that fixed it.



Related Topics



Leave a reply



Submit