silverstripe-framework/admin/javascript
James Bolitho 0cb98bcce2 Fix localStorage for Windows 8.1 IE11 desktop mode
In IE11 windows 8 call to window.localStorage was throwing out an access denied error.  Using try and catch manages the issue and allows the script to execute in IE 11 in desktop mode.

I think it is a problem with IE11 rather than the way Silverstripe is implementing the preview via an iframe from what I have been reading. http://blogs.msdn.com/b/ieinternals/archive/2009/09/16/bugs-in-ie8-support-for-html5-postmessage-sessionstorage-and-localstorage.aspx.  It seems that the way IE11 deals with localStorage is broken in certain cases but I am not 100% certain of the cause yet as I have not been able to find a definitive answer.  I only noticed it was a problem when a new client said they couldn't view the admin screen properly in IE11.  I took a look in IE11 and I was experiencing the same problem which makes the admin interface layout screw up and the preview doesn't work due the error mentioned in the first post.

Instead of the original code I submitted I have amended it and added an additional function to test more robustly to see if localStorage is available and can be accessed properly.  It is a copy of the code on a blog post Mathias Bynens has written about detecting if localStorage is available and can be used: https://mathiasbynens.be/notes/localstorage-pattern

I have added a console.warn as you suggested if localStorage is not available so that at least you get a warning if localStorage tests fail.

I have tested this on Windows 8.1: Firefox, Chrome & Mac: Firefox, Safari, Chrome and it seems to work as expected.  On IE11 it displays the admin area correctly now but obviously doesn't save the preview settings between page loads if localStorage is not available.
2015-08-29 15:54:14 +01:00
..
jquery-changetracker API Change tracker allows explicit dirty messages 2013-10-24 17:53:40 +13:00
jquery-fitheighttoparent MINOR Removing executable flag from all files (thanks miiihi) 2011-09-18 22:04:02 +02:00
lang Update translations 2015-01-12 17:54:49 +13:00
CMSSecurity.js API Enable re-authentication within the CMS if a user session is lost 2014-10-14 15:19:48 +13:00
leaktools.js ENHANCEMENT: In dev mode, include some basic leak detection functions in the admin panel 2012-06-15 01:19:19 +02:00
LeftAndMain.ActionTabSet.js Loading indicator for "more options" buttons 2012-12-14 00:32:06 +01:00
LeftAndMain.BatchActions.js Batch actions UI enhancement (#7878) 2012-11-02 22:57:14 +01:00
LeftAndMain.Content.js Strip duplicate querystrings from the url before adding document.location.search 2013-10-14 15:33:40 +02:00
LeftAndMain.EditForm.js Generic “cancel” button behaviour with History.back() 2013-11-22 12:47:35 +01:00
LeftAndMain.FieldHelp.js BUG Fix several issues around onmatch/onunmatch entwines. 2014-07-17 14:14:52 +12:00
LeftAndMain.js FIX: Ensure query string in X-Backurl is encoded (fixes #3563) 2014-11-16 20:35:41 +00:00
LeftAndMain.Layout.js FIX Dont update preview iframe if hidden 2013-08-21 09:29:28 +12:00
LeftAndMain.Menu.js API: Add attributes argument for CMSMenuItem. 2013-10-02 19:06:54 +13:00
LeftAndMain.Panel.js FIX: Expands the CMS' centre-pane when collapsed and it's clicked. 2015-01-14 08:40:05 +13:00
LeftAndMain.Ping.js BUG Fixing session keep alive for non-ADMIN users 2012-11-05 15:41:10 +13:00
LeftAndMain.Preview.js Fix localStorage for Windows 8.1 IE11 desktop mode 2015-08-29 15:54:14 +01:00
LeftAndMain.Tree.js BUG Fix jstree when duplicating subtrees 2014-04-29 16:00:07 +12:00
LeftAndMain.TreeDropdownField.js FIX 7763 TreeDropdownField needs to refresh after CMS edit form save 2012-08-29 10:52:56 +12:00
lib.js Fixed JS error in lib.js (fixes #3481) 2015-02-11 16:59:53 +00:00
MemberDatetimeOptionsetField.js BUG Fix several issues around onmatch/onunmatch entwines. 2014-07-17 14:14:52 +12:00
MemberImportForm.js BUGFIX: add missing onunmatches 2012-05-23 16:24:15 +12:00
ModelAdmin.js FIX Properly show link for showing and hiding class spec in model admin 2013-01-15 18:52:05 +13:00
SecurityAdmin.js Properly fix SecurityAdmin Groups javascript checkbox toggling. 2014-01-09 08:47:41 +13:00
ssui.core.js "Insert Media" dialog: Prevent loading indicator in IE8+ 2013-06-24 17:14:32 +02:00