1

On my application, I'm using the SWT browser widget to check for network connectivity. The reason for this is long, but long story short I HAVE to use the browser widget to check for connectivity. Unfortunately, on Mac and Debian, I get a modal dialog that pops up and tells me that the page load failed.

This message is being passed from the native browser and the SWT browser widget is passing this message through, displaying it as a modal dialog box. I need to intercept this message and handle it, displaying a more useful message to users in the event of a "Page load failed". Here's a screenshot of what it looks like:

SWT Browser Widget Modal Dialog error

Does anyone know how to intercept these messages instead of displaying them to the user?

blimmer
  • 2,038
  • 20
  • 23

1 Answers1

1

Few days ago, there was almost same question How to detect internet connection with SWT browser (or handle server not available). Check the answer for code, which might help you..

Community
  • 1
  • 1
Sorceror
  • 4,835
  • 2
  • 21
  • 35
  • Unfortunately this uses the Java Net library, which I do not have access to. I need to use ONLY the browser widget to check for connectivity. – blimmer Aug 17 '11 at 14:49
  • I have to ask ;], why? The message you are getting is from native OS widget and cannot be anyhow managed by SWT.. – Sorceror Aug 17 '11 at 15:28
  • Long story short I have to use the browser widget because many of our corporate customers use craziness with proxies and other non-standard networking methods which cause the Java networking layer to choke. We are also not using the Java VM and the environment we're using doesn't have a lot of the bells and whistles that the Java VM has. – blimmer Aug 17 '11 at 21:30
  • 1
    Oh, I see.. I have an other idea. If it is about to display local or inet-based help or something like this, you could write local page, which you will load as first. In the page, you'll send Ajax request (through jQuery or other framework) to your sites and if it will success, you can redirect the local page to internet one, if not, you could show the local content.. – Sorceror Aug 18 '11 at 06:10
  • 1
    The purpose of this is to ping a web service before I try to access it and display a useful message to the user. What I'm trying today is injecting some Javascript and using JS to communicate back to the Browser widget and then to Java to alert the user. We'll see how it works :-P – blimmer Aug 18 '11 at 14:48