0

In log out action, we are terminating the session by using terminate() method of session. But after log-out, if we click on back button of the browser, i can able to see the content of last page, but i am unable to do any action(This is fine). If we clear the browser cache after log-out, there is no problem. So we found, it is because of browser cache.

So please let us know how to clear the browser cache from webobjects application programmatically.

1 Answers1

0

I actually think it may retain cached information when you close out the UIWebView. I've tried removing a UIWebView from my UIViewController, releasing it, then creating a new one. The new one remembered exactly where I was at when I went back to an address without having to reload everything (it remembered my previous UIWebView was logged in).

So a couple of suggestions:

[[NSURLCache sharedURLCache] removeCachedResponseForRequest:NSURLRequest];

This would remove a cached response for a specific request. There is also a call that will remove all cached responses for all requests ran on the UIWebView:

[[NSURLCache sharedURLCache] removeAllCachedResponses];

After that, you can try deleting any associated cookies with the UIWebView:

for(NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {

    if([[cookie domain] isEqualToString:someNSStringUrlDomain]) {

        [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
    }
}

Happy Coding :)

Deepak

Deepak
  • 1,421
  • 1
  • 16
  • 20