最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Progress of loading external JS file - Stack Overflow

programmeradmin1浏览0评论

I'm not sure what this would be called to know what to search for, if this is a duplicate please link me :)

Is it possible in JavaScript in a browser, to load an external file (this bit is easy), but given that the external file could be rather large (say 50MB) show a progress indicator of the loading of that file?

i.e I, knowing the serverside size of the file, not knowing the gzip size, I want to say X% of file loaded.

I've not tried anything, I can't find anything to work from let alone find something that suggests its possible.

Problem: Trying to load up a 50MB JavaScript library on demand but show the progress of the loading.

I'm not sure what this would be called to know what to search for, if this is a duplicate please link me :)

Is it possible in JavaScript in a browser, to load an external file (this bit is easy), but given that the external file could be rather large (say 50MB) show a progress indicator of the loading of that file?

i.e I, knowing the serverside size of the file, not knowing the gzip size, I want to say X% of file loaded.

I've not tried anything, I can't find anything to work from let alone find something that suggests its possible.

Problem: Trying to load up a 50MB JavaScript library on demand but show the progress of the loading.

Share Improve this question asked Nov 16, 2013 at 5:07 PhillPhill 18.8k7 gold badges65 silver badges103 bronze badges 4
  • 50MB is huge! Is there any way to split this up into multiple files? Or reduce the size somehow? – Cameron Tinker Commented Apr 8, 2014 at 15:29
  • 1 @CameronTinker - bgrins.github.io/videoconverter.js this is the library. I want to do pre-upload video file checking :) – Phill Commented Apr 8, 2014 at 16:01
  • That's impressive! I will have to research this some more! I see on their website, they have a loading image indicating that the library is loading. – Cameron Tinker Commented Apr 8, 2014 at 16:06
  • Related issue github./kripken/emscripten/issues/613 – anatoly techtonik Commented Jan 28, 2015 at 13:26
Add a ment  | 

1 Answer 1

Reset to default 6

Use XMLHttpRequest to load the script and monitor its progress. When it's done, eval() it.

发布评论

评论列表(0)

  1. 暂无评论