[thelist] Recieved number of bytes (cleaned up script)

Daniel Saxe mistersaxe at hotmail.com
Wed Jun 23 01:56:07 CDT 2004

By using your more cleaned up version you will not take duplicate images 
into account. So if you are using the same image on a lot of places in the 
document you will add the file size of each of them. And as far as I know IE 
(and other browsers  as well, I guess) only downloads an image with the same 
url once. So the total size would then be wrong if using the same image in 
multiple places.

The fileSize property for the document and img is a IE-6.0 property.


>From: "Andreas Wahlin" <Andreas.Wahlin at ufl.gu.se>
>Reply-To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
>To: <thelist at lists.evolt.org>
>Subject: SV: [thelist] Recieved number of bytes (cleaned up script)
>Date: Tue, 22 Jun 2004 15:49:38 +0200
>Sorry for flaming!
>This is a more cleaned up version of the script which seems to work
>function weigh() {
>	var size = 0;
>	for (var i = 0; i < document.images.length; i++)
>		size += parseInt(document.images[i].fileSize);
>	size += parseInt(document.fileSize);
>	size = new String(size);
>	for(var i = size.length-1, j = 1; i > 0; i--, j++)
>		if (j/3 == Math.ceil(j/3))
>			size = size.substring(0, i) + ',' +
>size.substring(i, size.length);
>	alert('This page weighs '+size+' bytes.');
>If any javascript gurus out there can detect any real difference, please
>say so.
>It still doesen't work in mozilla though, reasen seeming to be that
>mozilla (firefox) doesen't have the image.fileSize attribute that IE
>seems to have. Is this true?
>* * Please support the community that supports you.  * *
>For unsubscribe and other options, including the Tip Harvester
>and archives of thelist go to: http://lists.evolt.org
>Workers of the Web, evolt !

Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

More information about the thelist mailing list