0

I am loading different news items in webview from seperate links. If user switches from one link to other, I need to clear the old data and reset my go forward and backward buttons. so that webview canGoBack and canGoForward methods return NO. How can I do something like [webView clearCache]? Is it possible in iOS 7?

tech savvy
  • 1,417
  • 4
  • 21
  • 42
  • Does the cache important for you at all ? – shannoga Apr 13 '14 at 04:52
  • The previous and next button takes me to the previous and next news article respectively. However, if I switch through them the buttons at top for webview navigation gets activated which jumbles up the news ids I am recieving from server for exact particular articles. I want to disable those top right buttons in order to avoid irrelevant navigation when somebody presses the buttons at bottom. – tech savvy Apr 13 '14 at 05:47
  • As you can see I have disabled previous button when I don't have news item in the array of articles. However, top right first button is enabled as there is still data in webview history. What to do for such cases? – tech savvy Apr 13 '14 at 05:49

1 Answers1

0

Clearing caches is not so good because user can be load the same article few time.

So it will be better if you check navigation type in webView:shouldStartLoadWithRequest:navigationType: If is UIWebViewNavigationTypeOther then back button should be disabled because it is not user caused navigation

But if you still want to clear cache see this question: How to clear UIWebView cache?

Community
  • 1
  • 1
sage444
  • 5,661
  • 4
  • 33
  • 60