Skip to content
webtoapkfree

Does a WebView app work without internet?

A WebView app works without internet only for content bundled in the app or already cached. A live website needs a connection and shows an error offline.

GuidesNookesh Karri

Light cover card with the title 'Does a WebView app work without internet?' in dark text and a green accent bar

A WebView app works without internet only for content that is stored inside the app or already cached on the phone. If the app simply loads your live website, it needs a connection, and offline users see an error page instead of your site. Bundled HTML, text and embedded assets keep working with no signal at all.

What happens when a WebView app has no internet

A WebView app that loads a live website shows an error page when the phone is offline, because the WebView has nothing to display. Android’s WebView guide says that by default all WebView does is show a web page, and loading one from the web requires the INTERNET permission.

On a phone with no connection, the default screen usually reads net::ERR_INTERNET_DISCONNECTED. Developers ask how to catch exactly this error in threads like this B4X forum question. To a user, it looks like the app is broken.

What works offline and what doesn’t

Whether a page works offline depends on where each file lives. The WebView itself doesn’t decide it.

Content in the app Works offline? Why
HTML, CSS and JavaScript bundled in the app Yes Files load from the app, not the network
Text pages built into the app Yes Same as bundled HTML
A live website No Every page is fetched from your server
Pages the app loaded earlier, with a cache mode set Sometimes Only what is already in the cache
A site with a service worker that caches pages Sometimes Only what the worker stored, never on first visit
Google Fonts, CDN scripts, maps, video, APIs No They come from other servers

The last row catches most people. A page can be bundled in the app and still break offline because it pulls a font or a script from a CDN.

How to make a WebView app work without internet

You can bundle the content, use the WebView cache, or add a service worker. Only bundling works on the very first launch.

Bundle the content in the app

Bundling means the HTML ships inside the APK. Android’s guide to in-app content says in-app content doesn’t require internet access or use the user’s bandwidth.

Google recommends WebViewAssetLoader, which serves your files from an HTTPS address such as https://appassets.androidplatform.net/assets/index.html. For a single page, loadDataWithBaseURL() works without app assets. The same guide warns that file:// URLs are opaque origins that can’t use fetch() or XMLHttpRequest, and it advises against turning on the file-access workarounds.

The trade-off is updates. Changing bundled content means shipping a new app version, and users on old versions see old content.

Use the WebView cache

The cache approach keeps a live site but reuses stored copies. The WebSettings reference lists four cache modes:

  • LOAD_DEFAULT uses cached files when they are available and not expired, otherwise the network. It’s the default.
  • LOAD_CACHE_ELSE_NETWORK uses cached files even if they have expired, otherwise the network.
  • LOAD_CACHE_ONLY never uses the network and loads from the cache.
  • LOAD_NO_CACHE always loads from the network.

A common pattern is to switch to LOAD_CACHE_ONLY when the phone reports no connection. That only shows pages the user already opened online. A fresh install on a train still gets an error.

Add a service worker to your site

A service worker is code on your website that caches pages for offline use. web.dev’s service worker lesson explains that it intercepts requests and can answer from Cache Storage even when the user is offline. Android WebView manages these workers through ServiceWorkerController, added in API level 24.

There are two catches. The worker does nothing until you write the caching code, and it isn’t available on the first load. web.dev recommends treating it as optional, not as the base of core features. If your site is already a solid PWA, see what a Trusted Web Activity is for another way to ship it.

How to test offline behaviour properly

An offline test only counts if the app starts from scratch with no connection. An app left open in the background can keep the page in memory and hide missing files.

  1. Install the APK on a real phone and open every page once while online.
  2. Turn on airplane mode, or turn off both Wi-Fi and mobile data.
  3. Close the app fully from the recent apps screen.
  4. Reopen it and tap every button, link and section.
  5. Note any blank area, missing icon or default font. Each one points to a file loaded from the network.

To compare with apps you already use, which apps use WebView explains how to check whether any app on your phone is built this way.

Should you show your own offline screen?

Yes, if your app loads a live site. A plain “You’re offline, try again” page beats a raw error code.

My take: if most of your users open the app on patchy mobile data, bundle the screens they need most and keep only the live parts online. A wrapper that is just a live site with no offline handling is broken the first time someone opens it in a lift. A reviewer who sees an error page may also judge the app as not working, which is one cause covered in why Google Play rejects WebView apps for minimum functionality.

How WebToAPK Free handles offline content

WebToAPK Free packs text pages and self-contained HTML into the app, so those sections work without a connection. Website sections load your live HTTPS site and need internet, as do external fonts, scripts, APIs and media.

Here is the limit. The tool does not download a website, its linked files or its backend for offline use, and it doesn’t import ZIP folders. The HTML importer takes one file up to 100 KB, so a large multi-file site has to be inlined or stay online. The offline HTML app guide walks through a small working example. Still choosing a format? Can I convert HTML to APK covers the basics.

FAQ

Why does my WebView app show ERR_INTERNET_DISCONNECTED?

The app is trying to load a live web page and the phone has no connection. WebView shows its own error page. Bundle the content in the app, rely on cached copies, or show your own offline screen instead.

Can a WebView app cache a website for offline use?

Partly. Android’s WebSettings cache modes can serve stored copies, and LOAD_CACHE_ONLY skips the network entirely. Only pages and files the app already loaded are in the cache, so pages a user never opened won’t appear.

Do service workers work in Android WebView?

WebView manages service workers through the ServiceWorkerController class, added in API level 24. Your site has to write the caching code itself, and the worker isn’t available on first load.

Will my HTML app work offline if it loads Google Fonts or a CDN script?

Not fully. Anything fetched from another server needs a connection. Embed fonts, styles and scripts in the HTML file so the page has everything it needs inside the app.

How do I test a WebView app offline?

Turn off the phone’s connection, close the installed app completely, reopen it and use every control and page. An online preview or an already open app can hide missing files.

Sources