shaunthomson
11-18-2012, 10:36 PM
Gidday guys
Am having a little trouble with a cache manifest file - maybe I'm misunderstanding what they do. Can anyone point out an obvious error to me?
Here's my set up -
My c.mf file has the following in it:
CACHE MANIFEST
2012-11-19:v2
CACHE:
js/com.js
NETWORK:
My php/html file has this in the html tag:
<html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en"manifest="http://www.mysite.com/c.mf">
What I'm trying to achieve:have the js file cached, but refreshed when I change the code in it. This is ensure any new js I add is updated when a user has an 'Add to home screen' bookmark of my site on their phone.
How I'm trying to do it: changing the js, uploading it, then replacing the date or V number in the c.mf file with a new one eg 2012-11-19:v3
My test: The js code has a function that shows an image when a button is clicked ie img01.jpg. It works fine - the image appears when I click the button.
I then change the js file to show a different image when the button is clicked ie img02.jpg - I upload the new js, change the v number in the manifest file and upload it, and ensure the new image is on the server.
I open my site with the home screen book marked icon. On testing, the old image appears when the button is clicked (not what I want). However, if I open my site in the phone's browser (as opposed to using the home screen icon), clicking the button shows the new image.
Also, strangely, if I home screen bookmark the new working version of my site (that shows the new image), and then click the bookmark to test running the site from the bookmark, the old image is shown on the button click.
So my js and image are fine. It's the caching where I'm coming unstuck.
Anything wrong with what I'm doing here?
Thanks for your time and help.
Am having a little trouble with a cache manifest file - maybe I'm misunderstanding what they do. Can anyone point out an obvious error to me?
Here's my set up -
My c.mf file has the following in it:
CACHE MANIFEST
2012-11-19:v2
CACHE:
js/com.js
NETWORK:
My php/html file has this in the html tag:
<html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en"manifest="http://www.mysite.com/c.mf">
What I'm trying to achieve:have the js file cached, but refreshed when I change the code in it. This is ensure any new js I add is updated when a user has an 'Add to home screen' bookmark of my site on their phone.
How I'm trying to do it: changing the js, uploading it, then replacing the date or V number in the c.mf file with a new one eg 2012-11-19:v3
My test: The js code has a function that shows an image when a button is clicked ie img01.jpg. It works fine - the image appears when I click the button.
I then change the js file to show a different image when the button is clicked ie img02.jpg - I upload the new js, change the v number in the manifest file and upload it, and ensure the new image is on the server.
I open my site with the home screen book marked icon. On testing, the old image appears when the button is clicked (not what I want). However, if I open my site in the phone's browser (as opposed to using the home screen icon), clicking the button shows the new image.
Also, strangely, if I home screen bookmark the new working version of my site (that shows the new image), and then click the bookmark to test running the site from the bookmark, the old image is shown on the button click.
So my js and image are fine. It's the caching where I'm coming unstuck.
Anything wrong with what I'm doing here?
Thanks for your time and help.