Bug 207542 - WKWebResourceLoadDelegate for WKWebView iOS
Summary: WKWebResourceLoadDelegate for WKWebView iOS
Status: RESOLVED DUPLICATE of bug 138169
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Enhancement
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2020-02-11 06:38 PST by Brandon
Modified: 2020-02-25 21:00 PST (History)
7 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Brandon 2020-02-11 06:38:42 PST
Please expose `WKWebResourceLoadDelegate` for iOS OR allow iOS to intercept traffic via `URLProtocol`.

Currently, iOS has no way of blocking certain page resources from loading or even intercepting certain page resources in a WKWebView. The ask is that we expose a method of allowing iOS to do this. `WKWebResourceLoadDelegate` is good for knowing which resources a page has requested and the ability to deny them. Similarly, `URLProtocol` would also work if allowed to work with WKWebView.
Comment 1 Radar WebKit Bug Importer 2020-02-11 09:26:48 PST
Comment 2 Maciej Stachowiak 2020-02-19 01:37:12 PST
This seems like a duplicate of <https://bugs.webkit.org/show_bug.cgi?id=138169> and/or <https://bugs.webkit.org/show_bug.cgi?id=205718.

Note that there is no such thing as WKWebResourceLoadDelegate. There is a non-public _WKResourceLoadDelegate interface, but it only has methods to observe requests after they have happened, not to modify or cancel them before they are issued.

It would help to have a more detailed explanation of the use case. If this is about blocking, do content blockers not work? What about them is insufficient?
Comment 3 Isaiah 2020-02-25 17:09:04 PST
Here is our use case for retargeting http/https requests. In our case we are not blocking, but redirecting unpublished/un-deployed content on a website that is a work-in-progress. We redirect the requests to the user's local resources in the project.

Comment 4 Alex Christensen 2020-02-25 21:00:19 PST

*** This bug has been marked as a duplicate of bug 138169 ***