HTML5
What is the Application Cache in HTML5?
The Application Cache, or AppCache, was an HTML5 feature that let web applications work offline by storing files listed in a cache manifest. It is now deprecated and removed from browsers. Modern offline support is built with Service Workers and the Cache API instead.
AppCache is DEPRECATED and has been removed from modern browsers. Do NOT use it in new projects. It is documented here for historical and interview context only.
What Was AppCache?
AppCache allowed a page to declare a manifest file listing the resources (HTML, CSS, JS, images) the browser should cache. Once cached, those files could load even without a network connection, enabling basic offline web apps.
<!-- Deprecated — do not use in new code -->
<!DOCTYPE html>
<html lang="en" manifest="app.appcache">
<head>
<meta charset="UTF-8">
<title>Old AppCache Example</title>
</head>
<body>
<p>This page once used AppCache for offline support.</p>
</body>
</html>Why Was It Deprecated?
- Confusing and error-prone caching rules that surprised developers.
- A cached page was always served even after updates, causing stale content.
- Poor control over exactly what and when to cache.
- It was superseded by a far more flexible standard.
The Modern Replacement
| Old (deprecated) | Modern replacement |
|---|---|
| AppCache manifest | Service Workers |
| Automatic file caching | Cache API (programmatic control) |
| manifest attribute on <html> | navigator.serviceWorker.register() |
Service Workers are scripts the browser runs in the background. Combined with the Cache API, they give precise, programmable control over caching, offline responses, and background sync — everything AppCache tried to do, done properly.
Key Takeaways
- AppCache provided offline support via a cache manifest.
- It is deprecated and removed — never use it in new code.
- Use Service Workers and the Cache API for modern offline apps.
