question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS 14 will enable Intelligent Tracking Prevention in WKWebView by default

See original GitHub issue

Bug 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.

https://github.com/GEDYSIntraWare/cordova-plugin-ionic-webview/blob/proxyios/src/ios/IONAssetHandler.m#L38-L85

https://github.com/GEDYSIntraWare/cordova-plugin-ionic-webview/compare/master...GEDYSIntraWare:proxyios

Information

WKWebView session from WWDC 2020

Webkit bug report

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:closed
  • Created 3 years ago
  • Reactions:50
  • Comments:40 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
NiklasMerzcommented, Oct 7, 2020

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.

6reactions
ardabeyazoglucommented, Oct 1, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS 14's Intelligent Tracking Prevention is Considered Harmful
Starting with iOS 14, the Intelligent Tracking Prevention raises some ... 2.3) was also activated (“on” by default) in the WKWebView.
Read more >
Intelligent Tracking Prevention In iOS 14, iPadOS 14, And ...
Across all iOS and iPadOS browsers, the new setting “Allow Cross-Website Tracking” is toggled off. This means that all these browsers are now ......
Read more >
Ionic (3) WKWebView IOS 14 ITP - Best options
Bug Report Problem Apple just announced that iOS 14 will enable "Intelligent Tracking Prevention" (ITP) by default in WKWebView.
Read more >
Niklas Merz on Twitter: "Hey @apachecordova developers ...
Bug Report Problem Apple just announced that iOS 14 will enable "Intelligent Tracking Prevention" (ITP) by default in WKWebView.
Read more >
213510 – iOS 14: ITP causes issues for hybrid (WKWebView ...
What it comes down to is how to provide just enough functionality for apps while not re-creating, in this case, cross-site tracking. As...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found