faqts : Computers : Programming : Languages : JavaScript : Images

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

15 of 16 people (94%) answered Yes
Recently 8 of 9 people (89%) answered Yes

Entry

how can I get the loading time of a Image ?

Aug 29th, 2000 09:05
Martin Honnen, Ignace LE ROUX,


You can roughly measure the time for loading an image in the following 
way:
  var start, end;
  var img = new Image();
  img.onload = function (evt) {
    end = new Date();
    alert(((end.getTime() - start.getTime()) / 1000) + ' seconds.');
  };
  start = new Date();
  img.src = 'whatever.gif';