Search code examples
iosobjective-cuiwebviewios8wkwebview

WKWebView Reader View


I am switching from UIWebView to WKWebView, and can't figure out how to set up my configuration for using Reader.
enter image description here

Is there anyone that can help me?

viewDidLoad:

WKWebViewConfiguration *config = [NSClassFromString(@"WKWebViewConfiguration") alloc] init];
    // Configuration of Reader goes here?
    wkWebView = [[wkWebViewClass alloc] initWithFrame:frame configuration:config];
    [self.view addSubview:wkWebView];
}

Solution

  • You cannot enable "Reader" mode for WKWebView (or UIWebView).

    Edit: You can however do this with SFSafariViewController as seen in the other solution.

    It occurs to me that it would be possible to modify the HTML code of the website to make it look more like Reader. It seems that there are services that already do this, like Readability:

    Just load this URL into your WKWebView: http://www.readability.com/m?url=YOUR_URL_HERE

    This should help you achieve a similar function to Reader.