简体   繁体   English

在浏览器中,Safari的私密浏览中的sessionStorage与Chrome的隐身模式和Firefox的私人窗口的工作方式不同?

[英]On a browser, sessionStorage in Safari's Private Browsing does not work the same as Chrome's Incognito Mode and Firefox's Private Window?

It seems that for sessionStorage , it works differently on Chrome's Incognito Mode vs Safari's Private Browsing and Firefox's Private Window? 似乎对于sessionStorage ,它在Chrome的隐身模式与Safari的私人浏览和Firefox的私人窗口之间的工作方式不同? I can find something on http://www.webdirections.org/blog/webstorage-persistent-client-side-data-storage/ but it doesn't say that Safari's Private Browsing will throw an exception. 我可以在http://www.webdirections.org/blog/webstorage-persistent-client-side-data-storage/上找到一些内容,但它没有说Safari的私人浏览会抛出异常。

The following is how I opened "Private Browsing": 以下是我打开“私人浏览”的方式:

  1. On Safari on Mac, click "Safari -> Private Browsing" on the menu bar 在Mac上的Safari上,单击菜单栏上的“Safari - >私密浏览”
  2. On Chrome, use "File -> New Incognito Window" 在Chrome上,使用“文件 - >新的隐身窗口”
  3. On Firefox, use "File -> New Private Window" 在Firefox上,使用“文件 - >新的私人窗口”

and on Safari, sessionStorage does not work, and if I do the following in the console: 在Safari上, sessionStorage不起作用,如果我在控制台中执行以下操作:

> sessionStorage["foo"] = 123.4
Error: QUOTA_EXCEEDED_ERR: DOM Exception 22

> sessionStorage["foo"] 
undefined

but on Chrome or Firefox, sessionStorage works as usual (as non-private browsing). 但在Chrome或Firefox上, sessionStorage照常工作(非私人浏览)。 Is the above accurate as far as sessionStorage is concerned? sessionStorage而言,上述是否准确?

Your assessment is practically accurate: 您的评估几乎准确:

  • Safari will just use a quota of 0 in private mode, so all attempts to set a value will fail. Safari将在私有模式下使用0的配额,因此所有设置值的尝试都将失败。 This is kinda OK according to the spec , as the spec does not mandate a minimum space requirement. 根据规范 ,这有点好,因为规范没有规定最小空间要求。
  • Chrome and Firefox still allow you to use storage, however private storage is independent from non-private, ie setting an item in private mode will not reflect back into non-private mode (important for localStorage only). Chrome和Firefox仍允许您使用存储,但私有存储独立于非私有存储,即在私有模式下设置项目不会反映回非私有模式(仅对localStorage很重要)。

Please note that other browsers are also free to throw QuotaExceededError exceptions at any given time, should you go over the quota. 请注意,如果您超过配额,其他浏览器也可以在任何给定时间自由抛出QuotaExceededError异常。

Safari latest version (Version 12.0) already have access to sessionStorage without any issue in incognito mode. Safari最新版本(版本12.0)已经可以访问sessionStorage,在隐身模式下没有任何问题。 在此输入图像描述

Safari Pivate mode supports localstorage and SessionStorage. Safari Pivate模式支持localstorage和SessionStorage。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用于跨浏览器检测隐身模式的Javascript(私人浏览) - Javascript For Cross Browser Detection of Incognito Mode (Private Browsing) 如何设置Selenium WebDriver在隐身/私有模式下启动的Chrome和Opera浏览器窗口大小? - How to set browser window size for Chrome and Opera launched by Selenium WebDriver in incognito/private mode? 无法在私人浏览器模式下运行silverlight应用程序(隐身窗口) - Unable to run silverlight application in private browser mode (incognito window) Chrome 的“隐身模式”究竟是做什么的? - What does Chrome's "Incognito Mode" do exactly? 如何获取 Chrome 隐身模式的历史记录? - How to get history of Chrome's incognito mode? 为什么 Chrome 的隐身模式比普通模式更快地检索资源? - Why does Chrome's Incognito mode retrieve resources faster than the normal mode? Firefox尝试通过专用浏览器与Chrome通信 - Firefox is trying to communicate with Chrome in private browsing Cookies不适用于Chrome,但可以在Firefox(localhost)中使用 - Cookies does not work with Chrome, but it's ok with Firefox (localhost) Chrome 设备模式下的 window.innerWidth - window.innerWidth in Chrome's device mode 无法使用 Google Chrome 的专用网络访问弃用试用版进行临时解决 - Unable to use Google Chrome's Private Network Access Deprecation trial for temporary work-around
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM