title: cacheing of webpage for offline use (android)
body: <p>i am following <a href="https://stackoverflow.com/questions/14670638/webview-load-website-when-online-load-local-file-when-offline">this</a> question from stack overflow for my query. the code works fine but when in offline mode it does not load any page , instead it shows no internet connection.</p>
  
  <p>i am doubtful if the webpage is really being written to the cache.</p>
  
  <p><strong>my code is below-</strong></p>
  
  <pre><code>private void openURL() {
      webView.getSettings().setAppCacheMaxSize(5 * 1024 * 1024); // 5MB
      webView.getSettings().setAppCachePath(getApplicationContext().getCacheDir().getAbsolutePath());
      webView.getSettings().setAllowFileAccess(true);
      webView.getSettings().setAppCacheEnabled(true);
      webView.getSettings().setJavaScriptEnabled(true);
      webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
  
      if (!isNetworkAvailable()) {
          webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
          Toast.makeText(MainActivity.this, "server offline. loading the cached website", Toast.LENGTH_LONG).show();
      }
  
      webView.loadUrl("http://www.google.com");
      webView.requestFocus();
  }
  </code></pre>
  
  <p>the toast i am displaying is displayed in no internet condition . so the code is working fine but the page is not being loaded.</p>
  
  <p><strong>logcat</strong></p>
  
  <pre><code>W/chromium: [WARNING:aw_network_delegate.cc(75)]    http://192.168.1.210/trackme/user/sendpagestest#-102#1
  [INFO:browser_view_renderer.cc(185)] [CalculateDesiredMemoryPolicy]   [58982400][180]
  register, handle(0xb8d834b0) (w:720 h:1280 s:720 f:0x1 u:0x000f02)
  cache file failed CRC check
  [INFO:CONSOLE(12)] "Not allowed to load local resource:    file:///android_asset/webkit/android-weberror.png", source:   data:text/html,chromewebdata (12)
  [getaddrinfo]: hostname=192.168.1.210; servname=(null); cache_mode=(null), netid=0; mark=0
  [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
  [INFO:SkUtilsArm.cpp(179)] Device supports ARM NEON instructions!
  E/SelfBrailleClient: Failed to bind to service
  E/SelfBrailleClient: Failed to bind to service
  D/OpenGLRenderer: Flushing caches (mode 0)
  D/OpenGLRenderer: Flushing caches (mode 0)
  D/GraphicBuffer: unregister, handle(0xb8d63a28) (w:583 h:88 s:592  f:0x1 u:0x000f02)
  E/SelfBrailleClient: Failed to bind to service
  E/SelfBrailleClient: Failed to bind to service
  E/SelfBrailleClient: Failed to bind to service
  D/WebView: loadUrl=http://192.168.1.210/trackme/user/sendpagestest
  W/chromium: [WARNING:aw_network_delegate.cc(75)] http://192.168.1.210/trackme/user/sendpagestest#-102#1
  I/chromium: [INFO:CONSOLE(12)] "Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png", source: data:text/html,chromewebdata (12)
  D/libc-netbsd: [getaddrinfo]: hostname=192.168.1.210; servname=(null); cache_mode=(null), netid=0; mark=0
  D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
  </code></pre>
  
  <p>please help me.</p>
  
  <p>thank you</p>
  
  <p><strong>update</strong></p>
  
  <p>i just now checked for google.com and it works fine. but when i do it with facebook.com then the same problem appears.</p>