gpt4 book ai didi

javascript - Chrome App API 中 webview 标签的分区属性是什么?

转载 作者:行者123 更新时间:2023-11-28 15:35:39 25 4
gpt4 key购买 nike

我现在正在开发 Google Chrome 打包应用。

我将使用 webview 标签为我正在开发的这个应用程序嵌入网页。

我正在阅读下面描述 webview 标签的文档。

https://developer.chrome.com/apps/tags/webview

但是,我不太明白这是做什么的。

谁能解释一下分区属性的用途吗?

谢谢!

<webview id="foo" src="http://www.google.com/" style="width:640px; height:480px" partition="persist:googlepluswidgets"></webview>

Storage partition ID used by the webview tag. If the storage partition ID starts with persist: (partition="persist:googlepluswidgets"), the webview will use a persistent storage partition available to all guests in the app with the same storage partition ID. If the ID is unset or if there is no 'persist': prefix, the webview will use an in-memory storage partition. This value can only be modified before the first navigation, since the storage partition of an active renderer process cannot change. Subsequent attempts to modify the value will fail with a DOM exception. By assigning the same partition ID, multiple webviews can share the same storage partition.

最佳答案

浏览器有一定的本地状态; localStoragesessionStorage、cookie 等

webview 是一个“迷你浏览器”。您可以有多个 webview,并且需要指示相同的分区,以便它们共享此状态(是同一浏览器的多个“选项卡”)。请注意,它们不会与主 Chrome 实例共享其状态。

如果您希望在关闭窗口时保持此状态,则需要将 persistent 添加到 ID。如果您正在处理需要 cookie 的内容,这很有用。

ID本身没有任何意义,它只是一个标识符。

关于javascript - Chrome App API 中 webview 标签的分区属性是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25697697/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com