iOS 14 will enable Intelligent Tracking Prevention in WKWebView by default
See original GitHub issueBug Report
Problem
Apple just announced that iOS 14 will enable “Intelligent Tracking Prevention” (ITP) by default in WKWebView. This issue is open for discussion around that and possible ways to fix Cordova apps that break with these changes. Please leave a 👍 if you are having issues with this change.
Possible solution -> Work in progress
- Add preference and features to allow users to disable ITP in settings
- Proxy HTTP(s) requests through WKUrlSchemehandler to handle cookies on the native layer.
- Get exceptions for
localhost
in WebKit?
Code - Workarounds
Currently the best solution in my case seems to build some kind of HTTP proxy with an WKURLSchemeHandler. I did this in the WKWebView plugin a while ago to workaround any CORS restrictions. Would this make sense to integrate into cordova-ios?
So the app runs on cordova://localhost
for example and you convert every external URL like https://myserver.com/image.png
to cordova://localhost/_httpproxy/myserver.com/image.png
and the WKURLSchemeHandler does the server request instead with native Code instead of letting the WebView doing it.
Information
WKWebView session from WWDC 2020
Environment, Platform, Device
iOS 14 beta
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Issue Analytics
- State:
- Created 3 years ago
- Reactions:50
- Comments:40 (7 by maintainers)
Top GitHub Comments
It could help if everyone here could comment here https://bugs.webkit.org/show_bug.cgi?id=213510 how they use Cordova and how ITP affects their apps. If Apple gets a better view about the apps out there and how they use the Webview, there is a small chance we can make Cordova better some day.
Until cordova handles this issue, a workaround is the following plugin to sync cookies. It worked in ios 14.0.1, which means server-set cookies sent in following requests.
https://github.com/CWBudde/cordova-plugin-wkwebview-inject-cookie