问题描述
我正在尝试创建一个不会在本地跟踪或存储任何浏览历史记录的webview(作为练习)。
我已经做到了这样,当webview关闭时,它会调用以下内容
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 following
[[NSURLSession sharedSession]resetWithCompletionHandler:^{}];
但我发现谷歌搜索历史之类的东西会在会话之间持续存在。我还尝试通过
but I am finding that things like google search history persists some how between sessions. I have also tried clearing cookies separately through
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[NSUserDefaults standardUserDefaults] synchronize];
仍无济于事。 Google搜索仍会在创建新的网络视图时显示。
是否有人知道如何删除Google用于将该搜索历史记录与我匹配的标识符?我担心它的类似于包标识符,这可能有点难以防止被读取。
任何想法都值得赞赏。
问候,
路加
still to no avail. Google searches still show when a new web view is created.
Is anyone aware of a way to remove the identifier that google is using to match that search history back to me? I'm concerned it's something like the bundle identifier, which is probably a bit trickier to prevent being read.
Any ideas are appreciated.
Regards,
Luke
推荐答案
尝试设置的 nonPersistentDataStore 作为的的 WKWebsiteDataStore 强>的 WKWebViewConfiguration
Try setting nonPersistentDataStore for WKWebsiteDataStore of WKWebViewConfiguration
以下是示例代码段
let webVuConfiguration = WKWebViewConfiguration()
webVuConfiguration.websiteDataStore =WKWebsiteDataStore.nonPersistentDataStore()
let webView = WKWebView(frame: webviewRect, configuration: webVuConfiguration)
这篇关于创建非跟踪应用程序内Web浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!