HTML and CSS Reference
In-Depth Information
Using the network whitelist
The NETWORK namespace works in a similar way to the
FALLBACK namespace, in that you can specify a full URL to
whitelist, or you can specify a prefix to match against.
There is also a special rule that if the NETWORK rule contains
only a * symbol, then any and all URLs that are requested, that
aren't in the application cache, will go via the network. You'd
think this would be normal behaviour, but without this flag the
browser is actually unable to make the web request. This is both
true when online and offline. Seems a little batty, right?
It's as if once the manifest file is in place, the browser is running
all of it's request routing though that file, and if there's not a rule
matching the request, the request will fail. This goes for both
local assets to the domain and remote assets. This is the area
that has possibly caught me out the most times—so it's worth
remembering!
This * character is an open whitelist and it's important because
it allows any asset that you've not accounted for in your mani-
fest to be requested. So if you don't have this rule and use
something like Google Analytics, the requests made to Google's
servers that track the usage on your site will fail, because the
manifest is in use, and there's no cached copy of this request,
nor fallback or network rule to allow the request to be made.
In general, I'd recommend having a final rule that sets the
whitelist as open. This should help during development and
avoid too many debugging headaches:
NETWORK:
/remote/
*
If you've also supported Firefox 3.6, you'll need to include the fol-
lowing two lines which act the same way as the * rule (and I know
this looks like the wildcard rule I said didn't exist, it just seems
that Firefox made a little mistake along the way—the new versions
of Firefox are all fixed and ignoring these two lines now):
http://*
https://*
These NETWORK rules tell the browser that all requests to any-
thing starting with /remote/ will go via the network, and any other
requests will go via the network (i.e. the web)—and now my
Google Analytics will be correctly tracked if my visitor is online.
 
Search WWH ::




Custom Search