You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Stasica <gs...@poczta.onet.pl> on 2007/05/30 00:55:22 UTC
how to check if page has been displayed (rendered) by the browser
hi,
My problem is that I've a big JSP page with a lot of scriptlets and a
JavaScript which basically reloads the whole page every 5s. The problem is
that my JavaScript makes a request to the server before the user has a
chance to see the whole page.
Is it possible to read somehow that the page was sent to the browser and
that the browser has completed rendering its content?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to check if page has been displayed (rendered) by the browser
Posted by Pierre Goupil <go...@gmail.com>.
Hello !
2007/5/31, Raghupathy, Gurumoorthy <Gu...@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)
Re: how to check if page has been displayed (rendered) by the browser
Posted by Jeremiah Johnson <jo...@egr.msu.edu>.
you could use JQuery to run a script after the document is loaded. See
at this url:
http://www.learningjquery.com/2006/09/introducing-document-ready
Raghupathy, Gurumoorthy wrote:
> Put your javascript at the last ... so you are sure that my the time your javascript is being executed your html is rendered
>
> -----Original Message-----
> From: Srepfler Srgjan [mailto:srgjan.srepfler@lnksystem.com]
> Sent: 31 May 2007 14:44
> To: Struts Users Mailing List
> Subject: Re: how to check if page has been displayed (rendered) by the browser
>
> Yup, I think this is a JS issue,
> Perhaps you should check if the DOM is loaded.
>
> 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?
>>
>> Torsten
>>
>> Greg Stasica schrieb:
>>
>>
>>> hi,
>>>
>>> My problem is that I've a big JSP page with a lot of scriptlets and a
>>> JavaScript which basically reloads the whole page every 5s. The problem is
>>> that my JavaScript makes a request to the server before the user has a
>>> chance to see the whole page.
>>> Is it possible to read somehow that the page was sent to the browser and
>>> that the browser has completed rendering its content?
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: how to check if page has been displayed (rendered) by the browser
Posted by "Raghupathy, Gurumoorthy" <Gu...@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
-----Original Message-----
From: Srepfler Srgjan [mailto:srgjan.srepfler@lnksystem.com]
Sent: 31 May 2007 14:44
To: Struts Users Mailing List
Subject: Re: how to check if page has been displayed (rendered) by the browser
Yup, I think this is a JS issue,
Perhaps you should check if the DOM is loaded.
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?
>
> Torsten
>
> Greg Stasica schrieb:
>
>> hi,
>>
>> My problem is that I've a big JSP page with a lot of scriptlets and a
>> JavaScript which basically reloads the whole page every 5s. The problem is
>> that my JavaScript makes a request to the server before the user has a
>> chance to see the whole page.
>> Is it possible to read somehow that the page was sent to the browser and
>> that the browser has completed rendering its content?
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to check if page has been displayed (rendered) by the browser
Posted by Srepfler Srgjan <sr...@lnksystem.com>.
Yup, I think this is a JS issue,
Perhaps you should check if the DOM is loaded.
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?
>
> Torsten
>
> Greg Stasica schrieb:
>
>> hi,
>>
>> My problem is that I've a big JSP page with a lot of scriptlets and a
>> JavaScript which basically reloads the whole page every 5s. The problem is
>> that my JavaScript makes a request to the server before the user has a
>> chance to see the whole page.
>> Is it possible to read somehow that the page was sent to the browser and
>> that the browser has completed rendering its content?
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to check if page has been displayed (rendered) by the browser
Posted by Torsten Römer <to...@luniks.net>.
Couldn't you use the JavaScript "Load" event to know when the page has
been completely rendered, and postpone your reload until then?
Torsten
Greg Stasica schrieb:
> hi,
>
> My problem is that I've a big JSP page with a lot of scriptlets and a
> JavaScript which basically reloads the whole page every 5s. The problem is
> that my JavaScript makes a request to the server before the user has a
> chance to see the whole page.
> Is it possible to read somehow that the page was sent to the browser and
> that the browser has completed rendering its content?
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org