Phill
Phill

Reputation: 18796

Progress of loading external JS file

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.

Upvotes: 6

Views: 3252

Answers (1)

jb_314
jb_314

Reputation: 1393

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

Upvotes: 6

Related Questions