Chrome App API中的webview标记的分区属性是什么? [英] What is partition attribute for webview tag in Chrome App API?
问题描述
我正在开发Google Chrome打包的应用程序。我将使用webview标记嵌入我正在处理的此应用程序的网页。
我正在阅读下面描述webview标记的这个文档。
但是,我不太明白这是什么。 任何人都可以解释一下分区属性是什么? 谢谢! webview标记使用的存储分区ID。如果存储分区 A webview是一个迷你浏览器。您可以拥有多个网页浏览,并且您需要指定相同的分区,以便他们共享此状态(是同一个浏览器的多个标签)。请注意,他们不会与主Chrome实例共享其状态。 如果希望通过关闭窗口来保持此状态,则需要添加 ID本身并不代表什么,它只是一个标识符。 I'm developing a Google Chrome packaged app right now. I'm going to use webview tag to embed webpages for this app that I'm working on. And I was reading this document below that describe webview tag. https://developer.chrome.com/apps/tags/webview But, I didn't quite understand what this is for. Could anyone please explain what partition attribute is for? Thanks!
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.
A browser has a certain local state; A webview is a "mini browser". You can have multiple webviews, and you need to indicate the same partition so that they share this state (be multiple "tabs" of the same browser). Note that they will not share their state with the main Chrome instance. And if you want this state to persist through closing your window, you need to add The ID itself doesn't mean anything, it's just an identifier. 这篇关于Chrome App API中的webview标记的分区属性是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
< webview id =foosrc =http:// www。 google.com/style =width:640px; height:480pxpartition =persist:googlepluswidgets>< / webview>
ID以persist :(分区=persist:googlepluswidgets)开头,那么
webview将使用一个永久存储分区,该存储分区可用于具有相同存储的应用中的所有
guest分区ID。如果ID为
未设置或者没有persist:前缀,则webview将使用
内存存储分区。此值只能在
第一次导航之前修改,因为活动的
渲染器进程的存储分区不能更改。随后尝试修改
值将导致DOM异常失败。通过分配相同的分区
ID,多个webviews可以共享同一个存储分区。 localStorage
, sessionStorage
,cookies等。
持久
给ID。
<webview id="foo" src="http://www.google.com/" style="width:640px; height:480px" partition="persist:googlepluswidgets"></webview>
localStorage
, sessionStorage
, cookies, etc.persistent
to the ID. Useful if you're working with something that needs cookies.