1

If I have an iOS app, how can I open a browser view inside the app (upon the user tapping a button) which contains no cookies from any domains?

This means the browser view should not remember cookies from the previous time the user opened the browser, nor share cookies with the Safari app.

There are now three classes to do web views as far as I understand, SFSafariViewController, WKWebView and the dated UIWebView. Which of these allows what I want to achieve?

forthrin
  • 2,709
  • 3
  • 28
  • 50
  • When I Google `ios webview forget cookies` I seem to get a lot of results, do they not work for you? – Pekka Mar 06 '16 at 10:33
  • If I can parse and delete cookies using this method, then yes! However, the article mentions the ageing UIWebView. Is it possible using the newer WKWebView or SFSafariViewController? – forthrin Mar 06 '16 at 10:37
  • I'm not an iOS dev (yet) so I don't know, but `ios WKWebView forget cookies` seems to yield some solutions, too – Pekka Mar 06 '16 at 10:38
  • Actually, disabling cookies altogether would work for me, as described in this article: http://stackoverflow.com/questions/26144883/ Can anyone confirm if this prevents all setting of cookies for WKWebView (even for the current browsing session)? – forthrin Mar 06 '16 at 10:41

1 Answers1

4

WKWebView is the way to go. Upon initialisation it won't contain any cookies from previous sessions. From the Apple documentation:

Each web view is given its own Web Content process until an implementation-defined process limit is reached; after that, web views with the same process pool end up sharing Web Content processes.

Furthermore, WKWebView is intended as a replacement for the older UIWebView.

SFSafariViewController shares cookies and other website data with Safari.

Pieter Meiresone
  • 1,910
  • 1
  • 22
  • 22