silverstripe-framework/admin
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
..
code FIX. Use i18n_plural_name() instead of plural_name() 2015-01-13 15:31:17 +02:00
css MINOR: Fix broken 'Insert From CMS' layout 2014-11-19 10:52:08 +10:30
images API Enable re-authentication within the CMS if a user session is lost 2014-10-14 15:19:48 +13:00
javascript Fix localStorage for Windows 8.1 IE11 desktop mode 2015-08-29 15:54:14 +01:00
scss MINOR: Fix broken 'Insert From CMS' layout 2014-11-19 10:52:08 +10:30
templates Remove "Filter" title if no search form is present 2015-01-07 16:22:12 +13:00
tests BUG Fix issue with generating tree data for missing pages 2014-08-08 15:29:28 +12:00
thirdparty Updated history.js dependency 2013-03-20 00:46:32 +01:00
_config.php Fix: WYSIWYG now returns valid HTML in tables 2014-04-01 10:16:07 +13:00
.gitignore MINOR Removing executable flag from all files (thanks miiihi) 2011-09-18 22:04:02 +02:00
config.rb Set default encoding for compass 2013-10-30 16:11:11 +00:00