Search code examples
iosswifturlpreloadwkwebview

WKWebView: Is it possible to preload multiple URLs?


Just migrated an app over to WKWebView and was wondering if there is any possible way to 'preload' multiple URLs, but only display one at a time?

I have a list of 5 URLs. I already know that I will be shown at some point in time, and I want to speed up the experience by pre-loading these for use in a single WKWebView.


Solution

  • I ended up just using NSURLCache and preloading all URLs using NSURLRequest and NSURLConnection. Then whenever I load a url into WKWebView it uses the cached requests per my cache policy.