Add support for NSURLProtocol to WKWebView
Originator: | DanyRSchneider | ||
Number: | rdar://24231298 | Date Originated: | 18-Jan-2016 |
Status: | Open | Resolved: | |
Product: | iOS | Product Version: | iOS 8 and above |
Classification: | Reproducible: |
Summary: It should be possible to implement features like custom HTTP request headers, content filtering, customized certificates for authentication and temporary custom proxy settings when using WKWebView. Some of these features would require using a custom NSURLProtocol with WKWebView. Some of these features would also be possible if WKWebView would support delegate methods as WebResourceLoadDelegate does with the classic WebView on OS X, for example: - (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource (to filter content and to add a custom header to a http request) Basically the same things as with UIWebView should be possible with WKWebView. This would allow all developers of web browsers and embedded browser features using WKWebView to move from UIWebView to WKWebView, but for that the same UIWebView possibilities should be provided in WKWebView. Steps to Reproduce: Use WKWebView. Try to modify a header in a HTTP request. Try to filter HTTP requests using the URL of the request. Try to authenticate a secure (https) server using a self-signed server certificate by embedding this certificate into an iOS app. Try to implement a support for custom proxy settings inside an app, which are different than the global iOS proxy settings. Expected Results: A custom NSURLProtocol can be registered so that all loading of data from the internet by a WKWebView is routed through (controlled by) that NSURLProtocol. Actual Results: WKWebView doesn't allow to use a custom NSURLProtocol. Version: Any iOS version. Configuration: All iOS devices
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
When can I use WKWebView with NSURLProtocol
I filed a similar bug in 2014 after WKWebView was announced and it was immediately marked as a dupe. See https://openradar.appspot.com/radar?id=5253455685877760