PDA

View Full Version : Help with Progressive Loading Script...


pharma
11-04-2002, 02:30 PM
I had a simple loading notification sript that shows up in the browser if the page is still loading and disappears "onload." I want to develop it because its too lame. I want it to be progressive. Like what I'm doing with my Flash animations. I always include a loading status so that when the viewers play it, it would be continous and not choppy because the file is still loading. Do you get what I'm trying to imply here?



Anyway, here is an extension of my idea:

<div id="01" style="visibility: hidden">Hello World</div>
<div id="02" style="visibility: hidden">Welcome to my website</div>
<div id="03" style="visibility: hidden"><img src="images/image.jpg"></div>

For example that's a part of my webpage. I understand that the browser (IE for ex.) reads the source codes downwards. So, what i want to do here is to detect what <div id=""> is currently being read/loaded and writes a message in the loading status telling the viewer what exactly part of the page is being loaded. Like, when the browser is reading the "images section" of my source code, it will display a message stating "Loading Image Files.." then if the browser is reading my "navigation section" it will change the display to "Loading Navigation System..."

Well, can anyone share their ideas about this matter?

oh btw, im sorry about my last thread. it was so stupid of me for not reading the thread above in this section.

krycek
11-04-2002, 03:22 PM
Well, I have no idea - I messed around for a bit but couldn't get anything to work - but I would LOVE to know how to do this so I will be watching this thread with great anticipation! :D

Come on, someone, help this guy! :cool:

::] krycek [::

eak
11-04-2002, 04:26 PM
i dont think you can get that detailed when loading because you would need a script to check if your page is loading and that script has to be loaded first then executed.

you could use the readyState property. i did make a script that uses that and it showed the current status of the document on the screen. go here to find out more about it.(http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/readystate_2.asp)

you could use onreadyStateChange to call a function that checks the state of your document then writes it into a layer.

pharma
11-05-2002, 05:27 AM
Can I see a sample of that?

pharma
11-05-2002, 07:03 AM
Oh btw, i forgot to mention this. You see the loading bar besides the status window of IE? Can JS get info from the loading bar and prints a messgae in a layer in the page?

krycek
11-07-2002, 01:15 AM
I have been thinking about this today, and the best I can come up with may not be suitable... but I think it would work :)

The idea is to create a global variable, such as loadedPercentage, which stores... yup, a value between 0 and 100 which would correspond to the amount of the document that has loaded.

At suitable point in the document you would put the following line:

<script language="JavaScript">loadedPercentage = 80</script>

where of course 80 stands for whatever value you feel is about right.

Problem one is that the line would have to be inserted in external script files etc. too if you are hoping for a smooth change in values - otherwise, guess the percentage based on the filesize of the script file :)

Problem two is that the page may be a php page or something, i.e. dynamic. Well, you would either have (a) no idea what percentage has loaded, or (b) have to write a more sophisticated and time-consuming script. And I really don't know if it would be worth it. :p

I did look into whether I could find out the file size and the amount loaded etc. but it does not seem possible. Neither does it seem possible to tap into IE's own loading bar :)

So, there we go... maybe of some use I am not sure. The third problem is how to implement the script. Getting to run properly before the rest of the document has loaded could be tricky, I think the only other way is to pass the value through to another frame and deal with it there.

Personally, I would love to be able to do this in a clean and easy way, but I think it is just not possible. If anyone manages to expand on my idea or comes up with anything at all, I will be very interested in the result :D

::] krycek [::