【问题标题】:is it possible to save/retrieve specific data from webview cache?是否可以从 webview 缓存中保存/检索特定数据?
【发布时间】:2017-02-02 14:42:29
【问题描述】:

我在包含表单的webview 中加载了一个网页,我想知道是否有办法将用户在表单中放入的数据保存在webview 缓存中并自动填写到他的下一个访问? 这就是我目前所做的一切。

webView.getSettings().setAppCachePath("/data/data/"+ getPackageName() +"/cache");
      webView.getSettings().setAllowFileAccess(true);
      webView.getSettings().setAppCacheEnabled(true);

      webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);

【问题讨论】:

    标签: android webview browser-cache


    【解决方案1】:

    不确定这是否正确,但是,在 webview 上运行 js 脚本以获取表单输入值、导航 html 的 DOM 树或使用带 id 的选择器怎么样?

    一旦你得到它们,你可以将它们存储在你的应用程序中并重新填充,在 webview 中加载页面之前,你可以操作 html(如果可以的话)或者你使用另一个 js 脚本来设置值

    我不确定,但我的东西缓存只用于可缓存的值(图像、css...)而不是用于输入

    【讨论】:

      猜你喜欢
      • 2011-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多