473,508 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
Jul 23 '05 #1
5 6248
On 5 Nov 2004 09:28:35 -0800, sq**********@hotmail.com (sonic_soul)
wrote:
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.
Jul 23 '05 #2
sonic_soul wrote:
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>

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #3
On Fri, 05 Nov 2004 18:00:00 GMT, Grant Wagner
<gw*****@agricoreunited.com> wrote:
sonic_soul wrote:
other than explicitly enabling every control in window.onload() event.


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.
Jul 23 '05 #4
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.

Jul 23 '05 #5
Jim Ley wrote:
On Fri, 05 Nov 2004 18:00:00 GMT, Grant Wagner
<gw*****@agricoreunited.com> wrote:

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


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..


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.
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1985
by: viator | last post by:
Hello everybody. I am a student doing my masters in Comp. Sci. Will some explain to me why it seems completely two worlds when taking about DHTML in NN and IE. Is there any way to write truly...
7
1460
by: Matt Kruse | last post by:
I've just put up a new script on my site: http://www.mattkruse.com/javascript/mktree/ This script combines javascript and some tricky CSS to create the easiest-to-implement...
16
2030
by: Ralph Freshour | last post by:
How can I disable a button once it has been clicked? I want to prevent the user from clicking on it twice if they have a slow connection. Thanks...
14
1853
by: Dafydd | last post by:
I have the following Script in my web page reduce to two pages. <script> function details() { document.getElementById('details').style.visibility='visible';...
0
1022
by: Fenno | last post by:
I have an ASP.NET web application that contains some pictures that sometimes take several seconds to load. These pictures are contained in user controls on the page (if that makes any difference)....
12
2234
by: Nalaka | last post by:
Hi, I suddenly started getting a lot of errors from html validation (some CSS) so I followed the following instructions to disable it. If you'd rather not have these types of HTML validation...
1
1900
by: Chris | last post by:
Can anyone recomend the best way of disabling a button a page until it is fully loaded? Would it need to be done with Javacript?
3
3795
by: ChrisN | last post by:
Invoking a postback before a large ASP.NET page has fully rendered will often cause the page to crash. This is unhelpful and confusing to users. I'm wondering if I can overcome this by...
0
7229
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7333
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.