Clearing WkWebview between requests

I have my own segment control that loads predefined URLs into WKWebView. I want to achieve WKWebView cleanup (empty) between loads.

So, right before I removed the real request, I tried to download:

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]];
[wkWebView loadRequest:request];

I even tried to load some kind of empty HTML to no avail:

[wkWebView loadHTMLString:@"<html><body></body></html>" baseURL:[NSURL URLWithString:@"about:blank"]];

This works for UIWebView. Any tips on this?

+4
source share
1 answer

This is possible through delegates. Just hide your webview before each request and enable it after the download is complete.

+1
source

All Articles