clean way for disabling dhtml functionality until page is fully loaded ?

S

sonic_soul

Hello,
I am finishing up creating a fairly complex page that is very rich in
DHTML. In addition to updating it self every couple of seconds,
various components on it support sync and async communication with
various web services.

The problem is that if a user tries to click on any JS driven content
before the page is fully loaded, it will not work properly since it
relies on many onLoad scripts that initiate webservices etc.

is there a clean way, to simply disable any page functionality before
it loads ?

other than explicitly enabling every control in window.onload() event.

TIA
-s
 
J

Jim Ley

other than explicitly enabling every control in window.onload() event.

Yes, this is much more sensible approach, don't give them anything to
click on until you're ready to handle it.

It's not difficult.

Do not use SYNC in webpages though, with JS sharing the UI thread, the
lockups you get are nasty.

Jim.
 
G

Grant Wagner

sonic_soul said:
Hello,
I am finishing up creating a fairly complex page that is very rich in
DHTML. In addition to updating it self every couple of seconds,
various components on it support sync and async communication with
various web services.

The problem is that if a user tries to click on any JS driven content
before the page is fully loaded, it will not work properly since it
relies on many onLoad scripts that initiate webservices etc.

is there a clean way, to simply disable any page functionality before
it loads ?

other than explicitly enabling every control in window.onload() event.

Set a global enabling boolean in window.onload() and have your functions
test it:

<script type="text/javascript">
window.onload = function() { window.isLoaded = true; }

function foo(bar) {
if (window.isLoaded) {
// do your stuff
} else {
alert('The page has no finished loading yet!');
}
}
</script>
 
J

Jim Ley

Set a global enabling boolean in window.onload() and have your functions
test it:

The problem with this though, is that the user can still attempt all
the actions and just get confused by nothing happening..

Jim.
 
J

jbjonesjr

Perhaps load the page as the last thing possible. Load the code and ui
into a frame, and the page into another frame. But the last load event
will be to change the navigation frame from a "wait while loading"
document to the document you want.
 
F

Fred Oz

Jim said:
The problem with this though, is that the user can still attempt all
the actions and just get confused by nothing happening..

1. put a big banner at the top saying "Please wait for page to load"

2. if any user event is fired whilst window.loaded = false; put up an
alert to say wait

3. In the onload(), hide the banner (display: none) and set
window.loaded = true;

Cheers, Fred.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top