struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre Goupil" <goupilpie...@gmail.com>
Subject Re: how to check if page has been displayed (rendered) by the browser
Date Fri, 01 Jun 2007 18:12:28 GMT
Hello !

2007/5/31, Raghupathy, Gurumoorthy <Gurumoorthy.Raghupathy@nielsen.com>:
>
> Put your javascript at the last ... so you are sure that my the time your
> javascript is being executed your html is rendered


Unfortunately, this doesn't work this way : you have no guarantee that your
page has finished *rendering* when your script is starting  executing.

Torsten Römer wrote:
> > Couldn't you use the JavaScript "Load" event to know when the page has
> > been completely rendered, and postpone your reload until then?


Yeah, you're right. And you must use the fact that the scripts contained in
the <head> tag are only launched on demand. Here's a snippet :

-------------------------------------------------------
<html>
<head>
<script type="text/javascript">

function init() { ...}

</script>
</head>



<body>
<script type="text/javascript">
            addEvent(window, "load",initAll);

<!-- When the page is fully loaded, we can do what we wish to -->
            function initAll() {
                       init();
                       ...
            }
</script>
</body>
</html>

-------------------------------------------------------

Cheers,


Pierre

-- 
"Mon horizon était désormais les pétales courbés,
Ma nouvelle demeure resplendissait de flèches d'herbes folles
Et d'oreillers de pollens odorants."

(Naïmah, le philosophe Fémereif)
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message