我们如何在webView中加载一个URL,以便存储客户端数据。

huangapple go评论115阅读模式
英文:

How can we load a URL in webView that it wants to storing client-side data

问题

这是我使用 webViwe 进行的第一个测试。

当我在 Web 浏览器中运行基本 URL = "https://baseUrl.com" 时,它会加载,然后 URL 会更改为 “https://baseUrl.com/login”,就像这样:

第一步:

我们如何在webView中加载一个URL,以便存储客户端数据。

第二步:

我们如何在webView中加载一个URL,以便存储客户端数据。

但是,当我在移动设备的 webView 中加载 “https://baseUrl.com”“https://baseUrl.com/login” 时,我只看到 第一步,从不进入 第二步

这是我的代码:

  1. override fun onCreate(savedInstanceState: Bundle?) {
  2. super.onCreate(savedInstanceState)
  3. setContentView(R.layout.activity_main)
  4. with(webView.settings) {
  5. javaScriptEnabled = true
  6. loadWithOverviewMode = true
  7. useWideViewPort = true
  8. }
  9. webView.webViewClient = WebViewClient()
  10. webView.loadUrl("https://baseUrl/login")
  11. }
英文:

It is my first test with webViwe.

When i run a base URL ="https://baseUrl.com" in web browser it load and then URL will change to
"https://baseUrl.com/login" like this :

Step one :

我们如何在webView中加载一个URL,以便存储客户端数据。

Step two:

我们如何在webView中加载一个URL,以便存储客户端数据。

But when i load "https://baseUrl.com" or "https://baseUrl.com/login" in mobile webView i just faced with step one and it never goes to step two.

This is my codes :

  1. override fun onCreate(savedInstanceState: Bundle?) {
  2. super.onCreate(savedInstanceState)
  3. setContentView(R.layout.activity_main)
  4. with(webView.settings) {
  5. javaScriptEnabled = true
  6. loadWithOverviewMode = true
  7. useWideViewPort = true
  8. }
  9. webView.webViewClient = WebViewClient()
  10. webView.loadUrl("https://baseUrl/login")
  11. }

答案1

得分: 0

你好<br>我认为这个问题来自你的网站端<br>据我所知,通过调用下一个网站,你的网站将被移动到下一页<br><br>
你是否调用了你的下一个网站...

英文:

Hello <br> I think this problem is from your web side <br>As far as I know your site will be moved to the next page by calling the next site <br> <br>
Did you call your next site ...

答案2

得分: 0

按照我在利用 DOM 存储的网站上找到的信息,我们应该在设置 webView 中添加以下内容:

  1. webView.settings.domStorageEnabled = true
英文:

As i found in websites that take advantage DOM storage we should add this in setting webView :

  1. webView.settings.domStorageEnabled = true

huangapple
  • 本文由 发表于 2020年8月22日 14:58:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/63533432.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定