try to detect browser running in private mode

This commit is contained in:
Luke Pulverenti 2013-08-23 18:13:45 -04:00
parent 6ee89acc1c
commit 17ee0b713a
2 changed files with 15 additions and 0 deletions

View File

@ -21,6 +21,17 @@ $.fn.checked = function (value) {
}
};
function IsStorageEnabled() {
try {
localStorage.setItem("__test", "data");
} catch (err) {
if ((err.name).toUpperCase() == 'QUOTA_EXCEEDED_ERR') {
return false;
}
}
return true;
}
if (!Array.prototype.filter) {
Array.prototype.filter = function (fun /*, thisp*/) {
"use strict";

View File

@ -1113,6 +1113,10 @@ $(function () {
alert("This browser does not support web sockets. For a better experience, try a newer browser such as Chrome (android, desktop), Firefox, IE10, Safari (iOS) or Opera.");
}
if (!IsStorageEnabled()) {
alert("This browser does not support local storage or is running in private mode. For a better experience, try a newer browser such as Chrome (android, desktop), Firefox, IE10, Safari (iOS) or Opera.");
}
});
Dashboard.jQueryMobileInit();