Search code examples
xamarin.ioswebkitwkwebviewwkwebviewconfiguration

WKWebsiteDataStore.default() vs webView.configuration.websiteDataStore


What is the difference between the WKWebsiteDataStore.DefaultDataStore and the one present in webview configuration instance - Configuration.WebsiteDataStore?

If i delete a specific cookie from HttpCookieStore by accessing the default websitedatastore, would that be in sync with HttpCookieStore present in Configuration.WebsiteDataStore when webview loads?


Solution

  • Unless you pass a WKWebsiteDataStore.nonPersistent() (which is new every time) dataStore to your webview's configuration it will already have the default in there (which is shared and it's always the same).

    You can check that yourself by running

    webview.configuration.websiteDataStore == WKWebsiteDataStore.default()
    

    And it will return true.

    So everything is definitely in sync since they are the same instance.