4

I am trying to use appcache to cache most of my webpage resources files (js, css) to speed up webpage loading. However, the problem is that appcache also cache the current webpage. This brings problem that the viewed webpage is not up to date. How can I prevent appcache from caching the current page, but only the resources that I listed in manifest?

My manifest sample:

CACHE MANIFEST
# Version 1
CACHE:
# List of resources file (JS/ CSS) path

NETWORK:
*
http://*
https://*
user1995781
  • 19,085
  • 45
  • 135
  • 236
  • possible duplicate of [Omit current page from HTML5 offline appcache but use cached resources](http://stackoverflow.com/questions/8320121/omit-current-page-from-html5-offline-appcache-but-use-cached-resources) – squid314 Jun 02 '14 at 14:34

1 Answers1

0

What you can do is have some conditional logic on the manifest-attribute in the html-tag, so you don't set the manifest for that page you don't want cached. I used that for login screens etc.

e.g.:

<html 
<?php if(!dontCacheThisPage) echo 'manifest="yourmanifest.appcache"'; ?>
>
Tommy
  • 11
  • 1