The cache manifest works fine and events fire on safari on iOS 8. Doesnβt work at all on WKWebView, does anyone else solve this problem?
import UIKit
import WebKit
class ViewController: UIViewController { @IBOutlet var containterView : UIView! = nil var webView : WKWebView? override func loadView(){ super.loadView() self.webView = WKWebView() self.view = self.webView! } override func viewDidLoad() { super.viewDidLoad() var url = NSURL(string:"http://html5demos.com/offlineapp") var req = NSURLRequest(URL:url) self.webView!.loadRequest(req) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() }
}
Application cache returned as supported if I have to use html5test.com
EDIT:
window.applicationCache does not return undefined either when loading from WKWebView
console.log("Initializing Page"); if (window.applicationCache == undefined){ console.log("Application cache not suported!"); updateSplash(); } console.log(window.applicationCache); returns: DOMApplicationCache
EDIT 2:
if (typeof window.applicationCache.update === 'function'){ console.log("Application has method update"); console.log(window.applicationCache.update); //shows swapCache() and update() methods window.applicationCache.update(); }
window.applicationCAche.update () throws Error: InvalidStateError: DOM Exception 11: An attempt was made to use an object that is no longer or can no longer be used.
source share