Cross-site Tracking (IOS)
See original GitHub issueBug description:
According to documentation, there is props thirdPartyCookiesEnabled
which is responsible for enabling/disabling third-party cookies on Android, on IOS third-party cookies is enabled by default: thirdPartyCookiesEnabled
I’ve found a website that can check third-party cookies in the browser: check third-party cookies. So If I set thirdPartyCookiesEnabled
WebView in Android application works as I expected, the website shows that third-party cookies are enabled. But WebView in IOS application shows that third-party cookies aren’t enabled.
Safari browser by default also doesn’t accept third-party cookies, but in the settings, there is a param: prevent Cross-site Tracking if I turn in off Safari will start to accept third-party cookies.
Tested it on Simulator iPhone 11 (13.4)
To Reproduce:
<WebView source={{uri: 'https://whatismybrowser.com/detect/are-third-party-cookies-enabled'}}
domStorageEnabled={true}
thirdPartyCookiesEnabled={true}/>
Expected behavior:
WebView IOS accepts third-party cookies in the same way as Android.
Mybe related question (without correct answer): thirdPartyCookiesEnabled on iOS
Environment:
- OS: IOS
- OS version: 13.4
- react-native version: 0.62.2"
- react-native-webview version: 10.3.2
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:15
Top GitHub Comments
This seems to be related to the WebKit feature, Intelligent Tracking Prevention (ITP). I found that when I add NSCrossWebsiteTrackingUsageDescription to the info.plist file, this triggers a switch to appear in the application’s device settings. The switch label is “Allow Cross-Website Tracking.” After setting this to switch to TRUE, third party cookies began working as expected in iOS 14.
The problem I’m experiencing now is that I am unsure how to programmatically check the state of this switch from within the app. I need to know the state of the switch in order to decide whether or not the user can successfully authenticate. The app relies on cookie storage in order to authenticate from within the webview (I don’t have any control over the client’s authentication method). WebKit mentions that you can use
document.hasStorageAccess()
, but this always returns true, regardless of the state of the switch. So it seems to be highly inaccurate.https://stackoverflow.com/questions/64897054/using-nscrosswebsitetrackingusagedescription-to-request-user-disable-itp-for-wkw
Issue is still present