Permalink
Browse files

BUG iOS safari navigation bug (fixes #8039)

  • Loading branch information...
kmayo-ss authored and chillu committed Nov 30, 2012
1 parent 700c95a commit 20a5bc1d36fde33cd552e8f30af6ff82e945839f
Showing with 16 additions and 1 deletion.
  1. +16 −1 admin/javascript/LeftAndMain.js
@@ -504,7 +504,22 @@ jQuery.noConflict();
if($(el).data('ignoreTabState')) return; // allow opt-out
activeTabs.push({id:id, active:$(el).tabs('option', 'active')});
});
- if(activeTabs) window.sessionStorage.setItem('tabs-' + url, JSON.stringify(activeTabs));
+
+ if(activeTabs) {
+ var tabsUrl = 'tabs-' + url;
+ try {
+ window.sessionStorage.setItem(tabsUrl, JSON.stringify(activeTabs));
+ } catch(err) {
+ if (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) {
+ // If this fails we ignore the error as the only issue is that it
+ // does not remember the tab state.
+ // This is a Safari bug which happens when private browsing is enabled.
+ return;
+ } else {
+ throw err;
+ }
+ }
+ }
},
/**

0 comments on commit 20a5bc1

Please sign in to comment.