Hacker News new | ask | show | jobs
by untog 2738 days ago
WkWebView is used a lot in apps to present content that isn't immediately obviously web content, rather it is just using HTML/CSS as a presentation layer. One example is the activity feed in Instagram - I only know this because once upon a time the page lost CSS on a reload and I got to see it in all its link-blue-bordered glory.

The Safari controller is for when you're linking out to an external web site and want the user to behave the way they would in a normal browsing session.

1 comments

A notable reason to use UIWebView is that it allows for changing network requests (for example, to add special headers). WKWebView does not because it runs out-of-process. So some of the web views you're seeing might actually be UIWebViews, depending on the context you're seeing them in.
WKWebView now does allow that, in a roundabout way, through WKURLSchemeHandler.
It seems like this can only be used to support URL schemes "that WebKit doesn't know how to handle"?
Yes, you create your own. In my example of the Instagram activity feed you'd point the view at instagram://activity-view or something like that in order to intercept the request and send a custom response. You could use the same method to "proxy" through to HTTP.