JavaScript loading progress of an image

前端 未结 7 1950
慢半拍i
慢半拍i 2020-11-29 18:55

Is there a way in JS to get the progress of a loading image while the image is being loaded? I want to use the new Progress tag of HTML5 to show the progress of loading imag

7条回答
  •  余生分开走
    2020-11-29 19:08

    for xmlhttpreq v2 check, use:

    var xmlHTTP = new XMLHttpRequest();
    if ('onprogress' in xmlHTTP) {
     // supported 
    } else {
     // isn't supported
    }
    

提交回复
热议问题