Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Bug fix for some browsers with Private (or Incognito) Mode turned on #10

Open
wants to merge 1 commit into from

1 participant

@stephen-uac

Bug fix for browsers that have localStorage, but don't have any space (this can be replicated by turning on private browsing on Safari Mobile on most iOS devices).

@stephen-uac stephen-uac Bug fix for private browsing mode
Bug fix for browsers that have localStorage, but don't have any space (this can be replicated by turning on private browsing on Safari Mobile).
d875f37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 9, 2013
  1. @stephen-uac

    Bug fix for private browsing mode

    stephen-uac authored
    Bug fix for browsers that have localStorage, but don't have any space (this can be replicated by turning on private browsing on Safari Mobile).
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/jquery.offline.js
View
12 lib/jquery.offline.js
@@ -36,7 +36,16 @@
// Allow the user to explicitly turn off localStorage
// before loading this plugin
if (typeof $.support.localStorage === "undefined") {
- $.support.localStorage = !!window.localStorage;
+ var localStorageTest = function() {
+ try {
+ localStorage.setItem("test", "test");
+ localStorage.removeItem("test");
+ return true;
+ } catch(e) {
+ return false;
+ }
+ };
+ $.support.localStorage = !!window.localStorage && localStorageTest();
}
// modified getJSON which uses ifModified: true
@@ -162,6 +171,7 @@
"NS_ERROR_DOM_QUOTA_REACHED") {
cleanupLocalStorage();
}
+ break;
}
}
Something went wrong with that request. Please try again.