1


in my app i'm using a webview to load a website for mobile devices. I've set up the webview for caching successfully. But if the device is offline and the user wants to visit a page which wasn't visited before it cannot be shown. This is clear because for a non visited page there is no counterpart in the cache. Therefore the webview shows the "Page not available" page.

So to my question:
Is it possible to check if a page exists in the cache before loading it in the webview?

kind regards
Christian

ChristianR
  • 133
  • 2
  • 7
  • Check onReceivedError in the WebViewClient class. Implement it and if you get an error tell the webview to do whatever you want in that case. – Pedro Oliveira Sep 09 '14 at 15:51
  • Thx for your comment. But is there a way to stay on the page were the link to the not cached page was clicked? – ChristianR Sep 09 '14 at 16:08
  • If you save the cache by yourself in the app cache directory then it's possible otherwise and AFAIK it's not possible. You can also load the page in a hidden webview first to see if it loads correctly but that's a nasty hack – Pedro Oliveira Sep 09 '14 at 16:16

0 Answers0