Bug 140571
| Summary: | Provide hook to alter (or at least add headers to) URL requests initiated from WKWebView | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Stuart Morgan <stuartmorgan> |
| Component: | WebKit2 | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Enhancement | CC: | ap, bfulgham, dieter, eugenebut, m.goleb+bugzilla, mkwst, sam, wilander |
| Priority: | P2 | Keywords: | InRadar |
| Version: | 528+ (Nightly build) | ||
| Hardware: | iPhone / iPad | ||
| OS: | All | ||
Stuart Morgan
There are a variety of cases where it's useful to be able to modify a request being made by a WKWebView. For instance, Chrome for iOS has several features which are based on adding headers to requests to certain servers, for all requests to those servers. Doing this with UIWebView is possible using http/https protocol handlers, but in WKWebView it's apparently impossible to do except for requests that are initiated from outside the web view.
It would be extremely helpful if there were a navigation delegate call (either a change to the existing one, or a new on) that would allow each NSURLRequest to be not just inspected, but potentially modified (at least the headers if not the whole request) before it was issued.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Stuart Morgan
Another case where this has come up is implementing Do Not Track, which requires adding a header to all requests.
Per our offline discussion, a partial solution that avoids synchronous communication back would be just a way to register a server->header map (with wildcards), that would cause all future requests to those servers to add the corresponding headers. It doesn't address all use cases, but would be a significant improvement.
Stuart Morgan
I forgot to note that this is rdar://19506439
Mike West
This is apparently making Mozilla's foray into iOS a bit more difficult as well: https://mail.mozilla.org/pipermail/mobile-firefox-dev/2014-December/000993.html
Alexey, could you help triage this to folks who might be able to look at the exposed API surface?
Mike West
John, Brent, perhaps one of you could route this to interested folks?