aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Before pageload event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Before pageload event" Watch "Before pageload event" New topic
Author

Before pageload event

Promod kumar
Ranch Hand

Joined: Jun 26, 2006
Posts: 90
I am trying to hook into the event that is triggered before the page starts loading. Is this possible. Window.onload is executed after the page is loaded, so it is too late for what I am trying to do.
The sequence of events as I understand it
1) The bowser sends a request
2) The browser receives a reponse
3) The browser starts loading the page
4) The page is loaded
5) The browser executes onload event if it is connected

I am trying to hook into step 3 if possible. I have searched quite a bit and have not found much. Thanks for your help.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Well adding a script tag to the page is called as the page is rendering.

What are you trying to accomplish exactly?


Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

At what point are you trying to hook into? Before or after the DOM is constructed?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Promod kumar
Ranch Hand

Joined: Jun 26, 2006
Posts: 90
I am troubleshooting an issue where our application hangs for about 20 minutes sporadically. Here is a partial html response which I got by doing view source.



I see line 1 printed in the log after 20 minutes of browser sending the request. Using app server logs and network logs, it is confirmed that the response does make it back to the workstation and the time taken is less than a minute. Our app runs in an embedded environment. I am trying to see if the first lines until the first script tag is taking those 20 minutes. I know it is unlikely, but I would like to prove it to myself that it is not the cause of the issue. My question is
1) When the browser(IE) sees the first lines until the first script tag, what does it do, does it try and access these sites and download the dtd, http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd and http://www.w3.org/1999/xhtml.

One possibility might be that the user has difficulty accessing these sites and so the browser just waits there.
Promod kumar
Ranch Hand

Joined: Jun 26, 2006
Posts: 90
Bear,
Before DOM is constructed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Before pageload event
 
Similar Threads
How to handle window closing event.
Refreshing the contents of a ResourceBundle w/o JVM restart?
Event After Load?
java.net.SocketException: Broken pipe in Tomcat
Frames loading twice on refresh