JAVA: How to know when a html page loading is finished with IE6 ???

  • Thread starter oneforall-allforone
  • Start date
O

oneforall-allforone

Hello,

I ' m a rookie in java. I have to write a specific java class using
java.awt.Robot feature to launch a web browser (IE 6) and load some
html page.
My problem is:

How to know when the html page loading is finished ???

I launch IE6 using Robot to double click on a shortcut to IE6 on the
desktop.

This is a scholatic project, the deadline is really near and I can't
find any help in javadoc, or java language specifications.
I've already spent a considerable amount of time trying to work out
with this, but I can't solve this alone.
I didn't find any person facing the same problem despite an intense
web seeking, so I hope smbdy will provide me with some help here.

thanks,

oneForAll-allForOne
 
C

Chris Smith

oneforall-allforone said:
I ' m a rookie in java. I have to write a specific java class using
java.awt.Robot feature to launch a web browser (IE 6) and load some
html page.
My problem is:

How to know when the html page loading is finished ???

Umm, no you can't do that in any kind of a sane way. You're attempting
to discover the internal state of a separate application. The only
thing I can think of is to take successive screen shots of the portion
of IE that displays the loading icon, and then compare them.

But that's utterly ludicrous. On the other hand, you are thoroughly
abusing the Robot class already. For example, I don't happen to have a
shortcut to IE on my desktop; would your application just not work for
me? So maybe utterly ludicrous is okay for your project?

Should you want to find a better approach, see if IE exposes a COM
interface for this, and look into JACOB or another COM bridge product to
see if it solves your problem.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
H

Hugo Pragt

How about this: at the end of your page place a little java thningy that
warns you when activated. That is the moment the page is (almost) completely
loaded...


Hugo
 
S

Steve Claflin

You can do it with javascript (subject to the caveat about js
potentially being disabled) by putting an "onload=serverAlert();" in
your html body tag, and have a js function: serverAlert() { var i = new
Image(); i.src = "alertServlet"; } where alertServlet is a servlet whose
doGet does whatever needs to be done when the page is finished.

You could get somewhat the same effect by putting a tag at the end of
your html body like <img src="alertServlet">.

It would be nice if that servlet returned something like a 1 pixel
transparent gif image worth of data.

Steve
 
G

Gordon Beaton

I ' m a rookie in java. I have to write a specific java class using
java.awt.Robot feature to launch a web browser (IE 6) and load some
html page. My problem is:

How to know when the html page loading is finished ???

I launch IE6 using Robot to double click on a shortcut to IE6 on the
desktop.

As others have suggested, you there is no straightforward way to get
that information.

I don't know what your requirements are (for example why you don't
just retrieve the page yourself in Java), but one idea might be that
you implement a simple local http proxy that you have the browser use.
The proxy, which can easily snoop the connection, will know when the
page download is complete and can notify your application.

/gordon
 
P

Phil...

What do you mean by page load complete?
Is it when all the HTML is completed, or is
it when enough of the HTML is complete to allow
for the first page to be displayed, or is
it when all of the graphics files are also completed?
 

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

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top