No document.fileSize in one page

Hello !

I'm coding a script to get the size of a page ...
It works VERY WELL in any page I try , BUT the page I really need this piece of code to work just refuses to accept the script .

In any page , this script works fine :

<SCRIPT LANGUAGE="Javascript">
var size = document.fileSize;
alert(size+' KB');
</SCRIPT>

But in the page I need , it says that I have an error in the line with the "document.fileSize" ! And I just can't figure out why ...

Thanks in advance ,
Claudio
cladinizAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jaysolomonCommented:
<jAy>

I copy/paste your code and it worked for me. Do you have any more code maybe in the page that you are having trouble with, that we can see.

</jAy>
0
jeronimusCommented:
Same Problem here:
i copy&pasted the script into a BLANK html page, alert worked great.

BUT when using the javascript in a by php generated page(maybe extension?) it gave an error on the fileSize function.
using "if(!document.fileSize){ alert('nope'); }" also made it trigger an error(=no alert).
using "var size = (document.fileSize)*1; " also didn't work...

maybe this helped a little

0
cladinizAuthor Commented:
This is a very silly thing ! Look what I've tried :

1 - I thought it could be a conflict between this and another javascript that I have in the page , so I took off all the javascripts from the page , left only this one ... and : doesn't work , the same error !

2 - I thought it could be some header problem ... I took off the all the headers from the beggining and I took off all meta tags ... and nothing ...

3 - I stripped down all flash files , iframes , and everything it was possible , until only left the code I wrote above and : NOTHING ! It was very strange !

So , I finally made up why doesn't work ... My page was built under php , and I had a php function session_start() in the top of the page ... I took off and worked !

The javascript function fileSize() can't be used togheter with the php sessions' functions ...

Anybody know a workaround ? I really need a way to know the page's size ... I know I can do with PHP file_size function , but it will only get the HTML size ... I need dome function , either in PHP or javascript to get the size of all the contents of a page , including images , and , if possible , .swf files and external .js and .css files .

I know I can do some php classes to do the whole work , but I don't have time ... Anybody know a solution ??

Thanks guys .

P.S.: Is this a bug ?? I never heard about it ... And I searched a lot and didn't find nothing

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

jeronimusCommented:
yup, sessions did the job :-|
BTW I noticed that the page properties (right-mouse-click -> properties) also didn't give a File size when using a php generated page(with session).

Maybe a solution to your fileSize problem:
- get the HTML/page fileSize, using PHP function
- get the img. fileSize using a javascript for loop ::

for(i=0; i < document.images.length; i++){
  sizeimg += document.images[i].fileSize;
}  

...
0
jaysolomonCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0
moduloCommented:
PAQed, with points refunded (125)

modulo
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.