Snabbreferens

HTML5 Application Cache Fusklapp (Arkiv)

En historisk referensguide för HTML5 AppCache: manifestsyntax, cache-händelser, uppdateringskontroll och migrering till Service Workers.

· Publicerad

En historisk referensguide för HTML5 Application Cache (manifest.appcache).

Föråldrat & Ej stött: Application Cache har tagits bort från webbstandarderna. Moderna webbappar använder Service Workers och Cache API för offline-cachelagring.

AppCache Manifest-syntax

CACHE MANIFEST
# Version 2026-11-08

CACHE:
/index.html
/styles/main.css
/scripts/app.js

NETWORK:
/api/
*

FALLBACK:
/offline.html

JavaScript-API (window.applicationCache)

const appCache = window.applicationCache;

appCache.addEventListener('updateready', () => {
  if (appCache.status === appCache.UPDATEREADY) {
    // Byt ut cachen och ladda om sidan
    appCache.swapCache();
    window.location.reload();
  }
});

// Tvinga uppdateringskontroll
appCache.update();

Referenser

Relaterade ämnen