cordova-plugin-wkwebview-engine
cordova-plugin-wkwebview-engine copied to clipboard
Cooperate with HTTP cache-control headers for 'ionic.local' serving.
I’m merely a humble Ionic2 developer. I’ve upgraded to WKWebView to get virtualScrolling to work properly, and now I see some odd behaviour with images.
My app is using some large unscaled images, and (distractingly) these are being visibly reloaded on certain events. When a (press) event handler is triggered on my component, the component is rerendered by Angular2 and this (it seems) is hard-reloading the images from "http://ionic.local/", which causes the images to disappear and reappear. With UIWebView (and "file:///" URLs) the images were not visibly disappearing and reappearing.
My guess is that browser caching of the images worked fine with "file:///" URLs, but the NSURLHandler in the wkwebview-engine plugin doesn’t do anything about cache-control/ETAG checking, so the same images are being fetched again from "http://ionic.local/"… causing the visual unpleasantness.
Perhaps the CDVWKWebViewEngine could calculate ETAG values based on file last-updated date and byte-size.
Mitigate flickering by reducing DOM updates (compare scope objects), thus improved my app on all platforms. Would be good to see this improvement however.