简体   繁体   中英

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??

Use applicationCache.oncached :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM