Creating WKWebView does not support cookies with Safari in OS X

How to make WKWebView not send cookies with Safari on OSX?

I have a very simple application that I did as an experiment that displays WKWebView, and as far as I can see, it collects cookies from Safari because in my user application I logged in to the same websites as Safari .

I am currently creating an instance of WKWebView as follows:

override func loadView() { self.webView = WKWebView() self.view = self.webView! } 

in created by NSViewController. I also tried this:

 override func loadView() { var processPool = WKProcessPool() var config = WKWebViewConfiguration() config.processPool = processPool self.webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 100, height: 100), configuration: config) self.view = self.webView! } 

but it didn’t make any difference to the storage of cookies. I have no problem creating my own cookie repository if it does not use hacks since previous hacks for WebView did not work. I just need cookies that cannot be used between my application and Safari.

+5
source share

Source: https://habr.com/ru/post/1214233/


All Articles