【问题标题】:Send Cookie with a URL fired from WebView in Android发送带有从 Android 中的 WebView 触发的 URL 的 Cookie
【发布时间】:2017-01-01 19:00:17
【问题描述】:

让我先解释一下场景,

假设有一个应用程序,其中有一个内容,如果您单击该内容,它将触发一个 URL(如http://some_host.com?param=val&url=http%3A%2F%2Fsearch.yahoo.com%20)并在 webview 中打开一个雅虎页面。当通过 webview 触发 URL 时,请求中没有设置 cookie。

如果我通过 chrome 触发相同的 URL,我可以看到请求中设置的 cookie。我怎样才能在 webview 中达到同样的效果。请提供一些启示。

非常感谢任何帮助。

【问题讨论】:

    标签: android cookies mobile webview


    【解决方案1】:

    您可以使用类 CookieManager 在此link查看更多文档

    要启用它,请使用以下代码:

    CookieManager().setAcceptThirdPartyCookies(myWebView,true)
    

    【讨论】:

    • 我无权访问应用程序的代码。是否有任何其他方式或某些设置可以开始传递 cookie?
    猜你喜欢
    • 2022-07-31
    • 2019-09-28
    • 2015-12-24
    • 2012-10-08
    • 2014-05-28
    • 1970-01-01
    • 2020-09-18
    • 2017-12-12
    • 1970-01-01
    相关资源
    最近更新 更多