开发者

HTML5 AppCache refresh - detect exactly which files are being downloaded

开发者 https://www.devze.com 2023-03-06 04:32 出处:网络
I am monitoring my HTML5 AppCache events by registering the events as follows: var appCacheEvents = [\"checking\", \"error\"开发者_JAVA技巧, \"noupdate\", \"downloading\", \"progress\", \"updateready

I am monitoring my HTML5 AppCache events by registering the events as follows:

var appCacheEvents = ["checking", "error"开发者_JAVA技巧, "noupdate", "downloading", "progress", "updateready", "cached", "obsolete"];
        for (var i = 0; i < appCacheEvents.length; i++) {
applicationCache.addEventListener(appCacheEvents[i], function (evt) {
// Code here to tell me the filename being downloaded???????
});
}

I am particularly interested in the downloading event. The evt object that is passed into the function does not seem to have any info about the file being downloaded Is there anyway to detect the name of the resource being downloaded? Thanks.


You're looking for the "progress" event, which fires for each file that is downloaded. Ben Nadel wrote a great article about this on his blog: http://www.bennadel.com/blog/2029-Using-HTML5-Offline-Application-Cache-Events-In-Javascript.htm

See also: http://www.slideshare.net/peterlubbers/using-html5-application-cache-to-create-offline-web-applications

0

精彩评论

暂无评论...
验证码 换一张
取 消