【问题标题】:One application two webview but only one localStorage一个应用两个 webview 但只有一个 localStorage
【发布时间】:2012-05-21 09:44:34
【问题描述】:

我有一个应用程序,在我的应用程序中有两个 webviews,我标记了 webview_One 和 webview_Two。

webview_One access "http://localhost:12345:/a/index.html"
webview_Two access "http://localhost:12345:/b/index.html"

在a/index.html和b/index.html我用localStorage操作一个变量都是localStorage.test 但是,当我在 a/index.html 中更改 localStorage.test 时,在 b/index.html 中我得到了在 a/index.html 中更改的值

为什么每个webview都不能存储localStorage?

我想知道如何让每个 webview 存储每个 webview 本身的 localStorage 值?

【问题讨论】:

    标签: html webview local-storage


    【解决方案1】:

    WebKit 仅使用一个数据库进行本地存储 - 查看 WebSettings 的文档

    另一方面,sessionStorage 可能会做你想做的事,但是当你离开页面时你会丢失数据

    【讨论】:

    • 为什么不能使用会话存储?您是否为网页视图启用了它?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多