Reputation: 4525
I'm using some WKWebView
s within my apps.
Basically, I have a first WKWebView
and the user should be able to create another one WKWebView
without any cookies so he/she wouldn't be logged in any account he logged in before on the first WKWebView
.
It's like an incognito browsing mode.
But I can't see anything that would allow me to do that with WKWebView
.
I think it's not possible as this bug suggests :
https://bugs.webkit.org/show_bug.cgi?id=140191
But maybe someone found a workaround ?
Any help would be really appreciated.
Upvotes: 3
Views: 2765
Reputation: 4525
After reading Apple's documentation, I finally got it to work.
I just initialise the WKWebView
with a non-persistent WKWebsiteDataStore
like that :
let configuration = WKWebViewConfiguration()
configuration.websiteDataStore = WKWebsiteDataStore.nonPersistentDataStore()
let webView = WKWebView(frame: CGRectZero, configuration: configuration)
Upvotes: 4