Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Browser - error code
Browser - error code [message #449024] Mon, 17 January 2005 22:58 Go to next message
Stefan Baramov is currently offline Stefan BaramovFriend
Messages: 33
Registered: July 2009
Member
How to get success/fail on loading html page in the browser widget?

The thing is that the browser widget's (test with IE6) method setUrl will
alway return true regardless of the page load success. And I need to know
the result: Page loaded or Page cannot be displayed.

Thanks
Stefan
Re: Browser - error code [message #449127 is a reply to message #449024] Tue, 18 January 2005 15:39 Go to previous message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
Yes, setUrl is asynchronous. ProgressListener.completed is fired when the
current location is considered completely loaded by the native browser. The
Browser API currently does not report specific notification when a resource
failed to load. You can open a feature request if you have a particular use
case for which it is needed.

Chris

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.browser.*;

public class PRBrowser {

public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("PRBrowser");
shell.setLayout(new FillLayout());
Browser browser = new Browser(shell, SWT.NONE);
browser.addProgressListener(new ProgressListener() {
public void changed(ProgressEvent event) {
}
public void completed(ProgressEvent event) {
System.out.println("URL "+((Browser)event.widget).getUrl()+"
completed.");
}
});
browser.setUrl("http://www.eclipse.org");
shell.open();

while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}

"Stefan Baramov" <stefan.baramov@trx.com> wrote in message
news:cshfuf$tgs$1@www.eclipse.org...
> How to get success/fail on loading html page in the browser widget?
>
> The thing is that the browser widget's (test with IE6) method setUrl will
> alway return true regardless of the page load success. And I need to know
> the result: Page loaded or Page cannot be displayed.
>
> Thanks
> Stefan
>
>
Previous Topic:Browser widget issue
Next Topic:Tool tip with F2 for focus
Goto Forum:
  


Current Time: Tue Apr 16 06:10:25 GMT 2024

Powered by FUDForum. Page generated in 0.07625 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top