I am a Javascript developer for a large news website. Recently we have started
using HTML5 localStorage. Some of our customers have complained about a
localStorage bug when using certain versions of IE8.
=== THE PROBLEM ===
The page hangs when this piece of code is run:
----------------------------------------------------
function hasLocalStorage() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch(e){
return false;
}
}
// ...
if(hasLocalStorage()){
window.localStorage.setItem("some_string", someStringVariable);
}
----------------------------------------------------
The above works in all browsers, except certain versions of IE8.
When I say this works on all other browsers I mean that older browsers such as IE7 fail gracefully. Only certain versions of IE8 pass the "return 'localStorage' ..." test but crash when localStorage is actually accessed.
=== TROUBLESHOOTING ===
Are we using the correct doctype declaration: "<!DOCTYPE html>"? -- YES
Try wrapping setItem() in a "try/catch" block. -- DONE, STILL HANGS
One of our users opened a ticket with Microsoft and was sent a stack trace of the crash. I can supply it if there is anyone in this forum who can interpret it.
Our QA team, which is offsite, has been able to reproduce the problem on some boxes, but I have not been able to do so on any of our development boxes, so my ability to troubleshoot the problem is limited.
Examples of QA boxes that have this issue:
IE8 Version: 8.0.6001.18702IC on Win XP SP3
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; BOIE8;ENUS)
IE8 Version 8.0.7601.17514 on Windows 7, Service Pack 1
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; .NET4.0C; .NET4.0E; InfoPath.3)
Example of a Developer box that has one of the problematic versions of IE8 but does not hang on our site. (This suggests that it might be a combination of IE8 and .NET framework that causes the problem.)
IE8 Version: 8.0.6001.18702IC on Win XP SP3
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3; BO1IE8_v1;ENUS)
=== CURRENT RESOLUTION ===
We have rewritten hasLocalStorage() to exclude all IE browsers below IE9. This is a very poor solution as we have over 1 million page views daily on IE8, and those viewers are being denied the full UX for our site.
=== QUESTIONS ===
- Has anyone else experienced a problem with IE8 versions 8.0.6001.18702IC or 8.0.7601.17514?
- Is there a way to use localStorage that works on all versions of IE8?
- If that is not possible, is there a way to detect which versions of IE8 have this bug? (If so I will be able to rewrite hasLocalStorage() so that it only excludes those versions.)
using HTML5 localStorage. Some of our customers have complained about a
localStorage bug when using certain versions of IE8.
=== THE PROBLEM ===
The page hangs when this piece of code is run:
----------------------------------------------------
function hasLocalStorage() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch(e){
return false;
}
}
// ...
if(hasLocalStorage()){
window.localStorage.setItem("some_string", someStringVariable);
}
----------------------------------------------------
The above works in all browsers, except certain versions of IE8.
When I say this works on all other browsers I mean that older browsers such as IE7 fail gracefully. Only certain versions of IE8 pass the "return 'localStorage' ..." test but crash when localStorage is actually accessed.
=== TROUBLESHOOTING ===
Are we using the correct doctype declaration: "<!DOCTYPE html>"? -- YES
Try wrapping setItem() in a "try/catch" block. -- DONE, STILL HANGS
One of our users opened a ticket with Microsoft and was sent a stack trace of the crash. I can supply it if there is anyone in this forum who can interpret it.
Our QA team, which is offsite, has been able to reproduce the problem on some boxes, but I have not been able to do so on any of our development boxes, so my ability to troubleshoot the problem is limited.
Examples of QA boxes that have this issue:
IE8 Version: 8.0.6001.18702IC on Win XP SP3
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; BOIE8;ENUS)
IE8 Version 8.0.7601.17514 on Windows 7, Service Pack 1
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; .NET4.0C; .NET4.0E; InfoPath.3)
Example of a Developer box that has one of the problematic versions of IE8 but does not hang on our site. (This suggests that it might be a combination of IE8 and .NET framework that causes the problem.)
IE8 Version: 8.0.6001.18702IC on Win XP SP3
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3; BO1IE8_v1;ENUS)
=== CURRENT RESOLUTION ===
We have rewritten hasLocalStorage() to exclude all IE browsers below IE9. This is a very poor solution as we have over 1 million page views daily on IE8, and those viewers are being denied the full UX for our site.
=== QUESTIONS ===
- Has anyone else experienced a problem with IE8 versions 8.0.6001.18702IC or 8.0.7601.17514?
- Is there a way to use localStorage that works on all versions of IE8?
- If that is not possible, is there a way to detect which versions of IE8 have this bug? (If so I will be able to rewrite hasLocalStorage() so that it only excludes those versions.)