【问题标题】:React Native webview cookies issueReact Native webview cookie问题
【发布时间】:2018-02-05 19:26:55
【问题描述】:

我在 webview 中遇到问题,无法在 iOS 上设置 cookie。

我在 webview 中实现第三方支付网关当用户被重定向到结果页面时,我收到一条消息说“浏览器中没有启用 cookie”

那么如何在 iOS 的 webview 中启用 cookie?

【问题讨论】:

  • 您有解决方案吗?我在 iOS 上的 RN WebView 上遇到了同样的错误。

标签: reactjs react-native native


【解决方案1】:

在 react native webview cookie 中默认启用请检查以下链接 https://facebook.github.io/react-native/docs/webview.html

thirdPartyCookiesEnabled?: bool 

Boolean value to enable third party cookies in the WebView. 
Used on Android Lollipop and above only as third party cookies are enabled by
default on Android Kitkat and below and on iOS. The default value is true.


<WebView
        source={{uri: 'https://github.com/facebook/react-native'}}
        style={{marginTop: 20}}
        thirdPartyCookiesEnabled : true
/>

【讨论】:

    【解决方案2】:

    在 webView 中使用属性 sharedCookiesEnabled={true}。 它在 myCase 中工作

    【讨论】:

      猜你喜欢
      • 2017-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-26
      • 1970-01-01
      • 2015-06-25
      • 2020-08-14
      • 1970-01-01
      相关资源
      最近更新 更多