One of my jquery plugins is having issues, and the issue occurs when private browsing is turned on in ios.
Is there a way to check this?
One of my jquery plugins is having issues, and the issue occurs when private browsing is turned on in ios.
Is there a way to check this?
In private mode user can't use local storage try this:
var storageTestKey = 'sTest',
storage = window.sessionStorage;
try {
storage.setItem(storageTestKey, 'test');
storage.removeItem(storageTestKey);
} catch (e) {
if (e.code === DOMException.QUOTA_EXCEEDED_ERR && storage.length === 0) {
// private mode
} else {
throw e;
}
}
I've found an Answear at GitHub and tested it: Working on IOS 11!
var isPrivate = false;
try {
window.openDatabase(null, null, null, null);
} catch (_) {
isPrivate = true;
}
alert((isPrivate ? 'You\'re' : 'You aren\'t') + ' in private browsing mode');