I am building an iPad app to be used in a public multi-user scenario and want to allow temporary web browsing sessions. However, when the session is finished, I want the app to clear all private browsing data including cache, cookies and history.
I have figured out how to clear the cache and the cookies, but the history is eluding me.
Just to be clear, I'm not looking to clear the back/forward history of the UIWebView
(I am creating a new instance of UIWebView
each time so that isn't an issue). I am looking to clear the entire application's browsing history, so that links do not appear visited.
For example, if I search for something on Google and visit one of the hits, the link turns purple the next time I Google it. I want all history and past web pages to be erased so that no links stay purple after the browsing session is reset.
Alternatively, if I could just entirely disable history tracking (like a "private browsing mode" à la Chrome or Firefox) that would also be acceptable.
Update: Interestingly, I noticed that quitting and restarting the app implicitly clears the browsing history, and links once again appear blue upon startup. However, this unfortunately doesn't help me at all because the app is designed and intended to be run for long periods of time across many users. We can't quit the app after each session.
Update 2: Further experimentation shows that the web history is definitely maintained on a per-application basis. I googled the same thing in Safari and the links that show purple each time in my app appear blue in Safari. There has to be a way to access this local storage from within the app.