I want to get the http status code , such as 202,404,302 .....
if it is 202 I will getContent,if 404 I will notify other components error. 3XX notify redirect.
How t o get the static code By Browser API?
thanks a lot
Hello,
JExplorer allows receiving status code only when an error has occurred during loading web page.
browser.setEventHandler(new DefaultWebBrowserEventsHandler() {
public boolean navigationErrorOccured(WebBrowser webBrowser, String url, String frame, StatusCode statusCode)
{
showMessageSwingLoop("Navigation error: " + statusCode);
return super.navigationErrorOccured(webBrowser, url, frame, statusCode);
}
});
Regards,
Vladimir Ikryanov
Hi
What will be the way with jxBrowser 2.0? Doesn't seem to have the setEventHandler method?
BTW, not only for 404 codes but also for script errors on page?
Thanks
-Yishai
Hi Yishai,
To handle JavaScript errors in JxBrowser you can use the following way:
BrowserServices browserServices = BrowserServices.getInstance();
browserServices.setPromptService(new DefaultPromptService() {
@Override
public CloseStatus scriptErrorRequested(ScriptErrorParams params) {
System.out.println("params.getMessage() = " + params.getMessage());
return super.scriptErrorRequested(params);
}
});
As for the navigation error handling. We have not implemented such ability in JxBrowser yet. We will add it in JxBrowser 2.2 version.
Regards,
Vladimir Ikryanov