如何检查ios是否使用隐私浏览 [英] How to check if ios is using private browsing
本文介绍了如何检查ios是否使用隐私浏览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的一个jquery插件存在问题,在ios中打开隐私浏览时会出现问题。
One of my jquery plugins is having issues, and the issue occurs when private browsing is turned on in ios.
有没有办法检查这个?
推荐答案
在私人模式下,用户无法使用本地存储试试这个:
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;
}
}
这篇关于如何检查ios是否使用隐私浏览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文