Offline webview(cache) support
See original GitHub issueIs there anyway to show the cached version when there is no internet? At the moment it shows only an error that there is no internet.
<WebView
cacheMode="LOAD_CACHE_ELSE_NETWORK"
cacheEnabled
sharedCookiesEnabled={true}
startInLoadingState
onError={() => console.warn("error")}
source={{
uri: "http://google.nl",
}
}
/>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:9
Top Results From Across the Web
Loading Cache when Offline in Android Webview
I have an application which loads urls from a website. Now I want the application to use the cache when offline ...
Read more >Is WKWebView Support HTML5 Offline Application Cache
HTML5 Offline Application Cache Is supported on Safari but is it supported in WKWebView? I found some links in StackOverflow but i am...
Read more >Offline webview(cache) support · Issue #1387 · react-native ...
Is there anyway to show the cached version when there is no internet? At the moment it shows only an error that there...
Read more >react-native-offline-cache-webview - npm
Start using react-native-offline-cache-webview in your project by running `npm i react-native-offline-cache-webview`.
Read more >react-native-offline-cache-webview - npm package - Snyk
CacheWebView is a custom implement of Android WebView resource interceptor. It beyond system WebView cache space limit, let cache config more simple ,fast...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey if you want to show your own custom error srceen try this:
if you did this remove your return and use this instead for reandering your content
if(netInfo.isConnected != false) { console.log("y wifi")
console.log("y wifi") return ( <WebView source={ YOUR URL } ) }
else if(netInfo.isConnected != true)
{ console.log("n wifi"); return( <WebView source={ YOUR CUSTOM HTML } scalesPageToFit={true} /> ) }
notice you can use HTML In webview https://reactnative.dev/docs/0.63/webview
you just check if you have a connection if yes then show your site and if you no connectio then your your custom html site .
hope i could help somebody
I think we can open a local default web page ( cached local ) when offline, instead page like this: