I'm working on a demo that makes use of the HTML5 offline manifest feature (nicely described here), and I'm having a hell of a time getting things to update in Firefox now that I've begun playing with things. I thought I had my demo ready to go. Whenever I changed my code I went into the cache manifest file and modified my header so that the server would see that the file was updated. This didn't always work, so I'd also go into Firefox settings (Tools/Options/Offline storage)and run Clear Now.
So in theory - that should tell Firefox that the next time I fetch my site it should rerun my cache manifest and update it's offline cache.
But here is where things are getting me. My final bit of code was failing because a file, find.html, was being sent from the cache, and not being updated, even though I had changed the file.
I updated my manifest file but that didn't work.
I then requested find.html directly in my browser - and even that didn't work.
I cleared cache, restarted Firefox, Apache, cleared cache again, and then this is where I noticed something odd. find.html has no mention of a cache manifest. At all. But when I request find.html in my browser, Apache loads a HTTP request was for my manifest file. So Firefox "knows" the file used to be in the cache and is asking for the manifest even though my HTML in find.html clearly does not tell it to load.
If I add ?x=1 to the URL, it works. But obviously I need a better solution.
So does anyone have any clues as to what this could be? To be clear, ./find.html is in the manifest, but if I make a direct HTTP request for find.html then why would my manifest be requested instead?
Archived Comments
Ok - so I'm hitting the sack now. I seem to have gotten things to work by manually renaming my manifest file. It's like Firefox decided it was smarter than I was and load my manifest even when I bypassed it.
I must be doing something wrong. I mean, at some point, Firefox must let me refetch an HTML page.
Can you check the HTTP headers and see if there's no Cache-Control headers?
And instead of adding ?x=1 why not include in your manifest file a comment with a version number like # v. 0.1 ?
Oh and it seems that FireFox 3.6 is buggy and the only workaropund is to tell your webserver to tell the browser not to cache the file. With Apache, add
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/cache-manifest "access plus 0 seconds"
</IfModule>
I have been trying version headers but it's not working. I also tried an expiresactive - but a bit different then that. Will try that one.
Nope, no go. I modified find.html, modified my manifest, reloaded Firefox, and FF didn't see the manifest as being new.
This seems to be helping:
http://stackoverflow.com/qu...
Do you mean that you had an error in your cache manifest?
No, but I could see when FF loaded new crap at least.
So now my problem is this. From what I thought I knew, if a request was NOT listed in the manifest, it should work online, but not offline.
I'm not seeing this. I have to use NETWORK: to add the stuff I want. But - * is not working. In Chrome this is especially evident. I load up a Google Map and it never loads. NETWORL: * doesn't do squat. This _kinda_ works:
NETWORK:
http://maps.google.com/maps...
http://maps.google.com/maps...
But the issue is that Google Maps loads another JS file (one not explictely loaded in my code) and that isn't loaded since it isn't in network.
I'm also having big troubles with the manifest file. if content has changed, and navigator is online, the old files are loaded form cache. meanwhile in the background the cachemanifest is also updated (if something has changed in the file like a version number). On the next request the new files are showing up.
this means, just the second request shows the correct files.
i workaround it like this: check if cachemanifest is updateready, then swapcache and reload the site.
Its not great but works.
if you have NETWORK: * at the end of the file it should load the files if the navigator is online, the app will not load if its offline and these files (maps) are requestet.
i always cache the maps files, because they never change.
This comment should also be noticed:
Oh, and interesting thing in Firefox (possibly other browsers) - changing a commented out line in the manifest (an approach Apple's developer documentation recommends) DOESN'T cause it to trigger an cache update. You must to add or remove a line with an active instruction (e.g. actually add or remove an entry for a file from the cache manifest) before it will recognise the manifest has updated. – Iain Collins Jun 14 '10 at 10:40
@Maertsch: I seem to be having some luck with a combo of
javascript:applicationCache.update()
in a tab as well as changing a comment line in the manifest
AS WELL as
reloading twice.
Royal. Pain.
And still - FF seems.... "off". I've got a question open on StackOverflow and will continue to report.
In Chrome, things now seem perfect, unfortunately, chrome does not have a simple way to mimic offline.
From the Mozilla developer site in regards to manually clearing the application cache...
The offline cache is not cleared via Tools -> Clear Recent History (bug 538595)
The offline cache is not cleared via Tools -> Options -> Advanced -> Network -> Offline data -> Clear Now (bug 538588).
The offline cache can be cleared for each site separately using the "Remove..." button in Tools -> Options -> Advanced -> Network -> Offline data.
Yeah, but that worked one time for me. I saw localhost in the list. I removed it. Later testing showed that it never came back. I still used "Clear Now", but my website never showed up.
Btw - as a side note - while FF is being bitchy - I did a quick test of my demo on my Android phone... and it worked! So along with being frustrated, I'm super excited too. Any iPhone user here want to give it a quick test for me ? If so- hit my contact form instead of using a comment.
I'm sure you saw this but just in case:
So here’s one thing you should absolutely do: reconfigure your web server so that your cache manifest file is not cacheable by HTTP semantics. If you’re running an Apache-based web server, these two lines in your .htaccess file will do the trick:
ExpiresActive On
ExpiresDefault "access"
So I take it back. I hate HTML5. It worked - then I broke it. Firefox reports an error -b ut refuses to say WHAT is wrong.
Ugh.
David - whats the IIS version for that?
Nice - Chrome told me the actual error. IIS didn't have the mime type.
Ugh. I don't know what to even think now. Chrome says the manifest is good. In my testing on my Android it worked once. Then the second time it gave me a warning. I could bypass the warning, but then my code which checks for offline/online was ignored. If folks want to see what I'm doing, be my guest, but at thispoint I'm considering giving up.
www.coldfusionjedi.com/demo...
I noticed that when hitting your demo I got a warning on a PC running safari but no warning on the mac running safari.
Ray, I'm not sure but I think IIS would read the same.
OOPS!
in web.config of course.
Ray . . . that's a bad link - two compounded URLs.
BlogCFC got confused. Just copy the URL by hand.
Useful post! I've exactly the same problem. Firefox doesn't update the cached manifest file...
I think this tips could resolve my problem ;-)
Thank you!