You could do a frequent Ajax request to your server, e.g. using jQuery Ajax and a low timeout
setting.
The error
callback receives the reason for the error in the second argument. If the message is timeout
or error
, your callback could display a semi-transparent overlay spanning across the whole screen showing the "not available" error message.
Once the Ajax requests succeeds again, you would hide the overlay. In IE7+ and other browsers the CSS for the overlay would be as easy as position: fixed; left: 0; right: 0; top: 0; bottom: 0
but in IE6, it's a bit more difficult - you'd have to look it up.
The overlay is not the perfect solution when the user has started entering some text. If the connection is gone for good, they need access to the text field to copy+paste its contents. You may want to disable the submit
button of the current form instead. But that really depends on the context of your application, and will have to be decided by you.