Disable Link-Navigation in mozSwing

nimloth <[email protected]> Thu, 19 Feb 2009 06:13:24 -0800 (PST)
Newsgroups gmane.comp.mozilla.devel.java
Organization http://groups.google.com
Message-ID <05d36a3c-bdba-4f59-a5b5-740f68854b35@q18g2000vbn.googlegroups.com>
Hi folks

I have a special use case for mozSwing: I have to disable the link
navigation, so that when the user clicks on a link nothing happens.
The user should view a single page which he can’t change by clicking
on a link.

I tried the following:
I attached a nsIWebProgressListener and in onLocationChange I canceled
the request: request.cancel(IXPCOMError.NS_ERROR_ABORT); The problem
is that the page already changes its location but can’t be loaded
completely because I disabled the request.

I then played around with the code and finally ended with
MozillaPanel.goBack().
Called inside onLocationChange an exception is raised and the request
is stopped completely - the behavior I want but since this solution
"works with exceptions" I dislike it very much.

I hope you can help me.

Best regards
Sandro