Search code examples
ioscachingnsurlsessionwkwebviewnshttpcookie

how to support incognito/private mode in wkwebview/uiwebview


I am working on a incongnito browser.I am using wkwebview when I clear all the cookies I can see that popular search engine like google remembers the searches that has been made.

I tried cleaning all the cookies in NSHTTPCookieStorage and resetcookies using NSURLSession but its still not working.


Solution

  • Set nonpersistentdatastore for wkwebsitedatastore for wkwebviewconfiguration for wkwebview

    Set NSURLrequestreloadcacheignoringlocalandremotecachedata for NSURlrequest in uiwebview

    Reference

    Creating a non-tracking in-app web browser