Tarang
Tarang

Reputation: 75945

HTML5 Appcache loaded event

I have an offline 'redirector' script. Basically a page that has javascript window.location = 'xx' to redirect me to my correct location depending on cookies.

The problem is the manifest will not download and cache if the redirect is too soon (hence canceling the appcache download). So i've thrown in a delay there.

Obviously people have different internet connection speeds so is there a way to say when the manifest is loaded then execute this javascript (a callback or event) or something??

Upvotes: 0

Views: 686

Answers (1)

gilly3
gilly3

Reputation: 91467

Use applicationCache.oncached:

applicationCache.oncached = function (e) {
    location.href = "xx";
};

Upvotes: 1

Related Questions