Creating a non-tracking in-app web browser

前端 未结 2 2014
闹比i
闹比i 2021-02-09 04:29

I am trying to create a webview (as an exercise) that does not track or store any browsing history locally.
I have made it so that when the webview is closed, it calls the f

相关标签:
2条回答
  • 2021-02-09 05:06

    Try setting nonPersistentDataStore for WKWebsiteDataStore of WKWebViewConfiguration

    Here is a sample code snippet

    let webVuConfiguration = WKWebViewConfiguration()
    webVuConfiguration.websiteDataStore =WKWebsiteDataStore.nonPersistentDataStore()
    let webView = WKWebView(frame: webviewRect, configuration: webVuConfiguration)
    
    0 讨论(0)
  • 2021-02-09 05:07

    To compliment Durai Amuthan.H's answer, here is the answer for us plebs who still like to use Obj-C

    WKWebViewConfiguration * config = [WKWebViewConfiguration new];
    config.websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];   
    webView = [[WKWebView alloc]initWithFrame:viewFrame configuration:config];
    
    0 讨论(0)
提交回复
热议问题