These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:13 pm Advanced search

Manifest wont cache javascript

If you are stuck or have questions regarding HTML or other Web technologies, ask your questions here. No question too dumb!

Manifest wont cache javascript

Postby pafke » Thu Apr 28, 2011 2:05 pm

Hi,
I'm currently experimenting with html5. At the moment I'm implementing a manifest file to make sure my webapp can be vieuwed offline as well. I'm basically caching just about everything, but for some reason my javascript won't cache.
I'm using a script from iscroll to make sure my footer stays fixed in screen, but this script doesn't work as soon as I cache it.

This was my previous manifest:
Code: Select all
CACHE MANIFEST
CACHE:
index.html
nieuws.html
live.html
fotos.html
media.html
css/main.css
scripts/iscroll.js
images/icon.jpg
images/logo.png
images/back.png
images/fav.png
images/home.png
images/home_active.png
images/koers.png


With this it just skipped the javascript after loading the pages from the manifest.

Adding a
Code: Select all
NETWORK:
*
made sure the webapp worked as it should, but as soon as I got offline, the javascript is no longer functional...

Can anyone tell me what I'm doing wrong?
pafke
<h6>
 
Posts: 7
Joined: Thu Apr 28, 2011 1:59 pm

Re: Manifest wont cache javascript

Postby zcorpan » Thu Apr 28, 2011 8:25 pm

Got a link? Is your script file served with a cache-control: no-store header?

Does http://appcachefacts.info/ help?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Re: Manifest wont cache javascript

Postby pafke » Fri Apr 29, 2011 7:07 am

pafke
<h6>
 
Posts: 7
Joined: Thu Apr 28, 2011 1:59 pm

Re: Manifest wont cache javascript

Postby pafke » Fri Apr 29, 2011 7:18 am

Just finished reading your link, which was verry informative but unfortunately it did not help me with my problem. The javascript file has not cache-control.

I'm still quite puzzled by this..
pafke
<h6>
 
Posts: 7
Joined: Thu Apr 28, 2011 1:59 pm

Re: Manifest wont cache javascript

Postby zcorpan » Fri Apr 29, 2011 8:24 am

The js file seems to have Cache-Control: max-age=0, but the other files have that too and it shouldn't make it not be cached by appcache. Hmm.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Re: Manifest wont cache javascript

Postby pafke » Fri Apr 29, 2011 8:27 am

even though it should not matter, where is this defined?
Code: Select all
Cache-Control: max-age=0
pafke
<h6>
 
Posts: 7
Joined: Thu Apr 28, 2011 1:59 pm

Re: Manifest wont cache javascript

Postby zcorpan » Fri Apr 29, 2011 10:06 am

It's an HTTP header your server sends along with the file. You can see the headers with e.g. http://www.rexswain.com/httpview.html

You can change which headers are sent with httpd.conf or .htaccess.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Re: Manifest wont cache javascript

Postby pafke » Fri Apr 29, 2011 11:46 am

-sigh- I feel so stupid, I referenced to a version of the javascript file with src="scripts/iscroll.js?v3.7.1" while caching the normal iscroll, removing the ?v3.7.1 solved the issue.

However, I'm still having problems implementing the fallback page.
Code: Select all
FALLBACK:
offline.html


The offline page is in the same directory as all the others, but it doesn't seem to work.
pafke
<h6>
 
Posts: 7
Joined: Thu Apr 28, 2011 1:59 pm

Re: Manifest wont cache javascript

Postby zcorpan » Fri Apr 29, 2011 12:50 pm

When the current section is the fallback section, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters, a valid URL identifying a resource other than the manifest itself, one or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters, another valid URL identifying a resource other than the manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters.

http://www.whatwg.org/specs/web-apps/cu ... -manifests

The spec has this in an example:
Code: Select all
FALLBACK:
/ /offline.html


Maybe if you want the current directory to be the fallback namespace you could do
Code: Select all
FALLBACK:
./ offline.html
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Re: Manifest wont cache javascript

Postby pafke » Fri Apr 29, 2011 1:08 pm

That did the trick. Thnx mate!
pafke
<h6>
 
Posts: 7
Joined: Thu Apr 28, 2011 1:59 pm

Re: Manifest wont cache javascript

Postby pafke » Fri Apr 29, 2011 2:29 pm

-grumbl-

Now it works on pc and HTC, but it fails on iPhone -.-
pafke
<h6>
 
Posts: 7
Joined: Thu Apr 28, 2011 1:59 pm


Return to Help & Advice

Who is online

Users browsing this forum: No registered users and 1 guest