Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Limit Browser use of external URL's?
Limit Browser use of external URL's? [message #780033] Mon, 16 January 2012 22:23 Go to next message
Eclipse UserFriend
I have a view that uses a Browser control.
It looks great, EXCEPT that I have to be able to control what external URL's it has access to. (and no, I don't have any control over the HTML that is being displayed.)
Is there an example somewhere of doing this?
Re: Limit Browser use of external URL's? [message #780557 is a reply to message #780033] Wed, 18 January 2012 10:53 Go to previous messageGo to next message
Eclipse UserFriend
It looks like I would need to use XPCom - but it also appears that XPCom is no longer supported by Mozilla.
See: https://developer.mozilla.org/en/JavaXPCOM/Embedding_Mozilla_in_a_Java_Application_using_JavaXPCOM

So, if XPCom is no longer supported, what SHOULD I be using?
Re: Limit Browser use of external URL's? [message #780576 is a reply to message #780557] Wed, 18 January 2012 11:36 Go to previous messageGo to next message
Eclipse UserFriend
Even if I do need to use XPCom, the docs on the Browser object say:
"the classes from JavaXPCOM >= 1.8.1.2 must be resolvable at runtime"
"the version of the underlying XULRunner must be >= 1.8.1.2"

And I have been unable to find the relevant jars.
XULRunner seems to be up version 10 or so now, but no longer includes JavaXPCom, MozillaInterfaces.jar. Which is required.
Re: Limit Browser use of external URL's? [message #780585 is a reply to message #780576] Wed, 18 January 2012 12:10 Go to previous messageGo to next message
Eclipse UserFriend
So, I decided to just see what I get when I call Browser.getWebBrowser().
null.

So, apparently RCP doesn't even support this anymore, and it's just not documented.
Re: Limit Browser use of external URL's? [message #780970 is a reply to message #780585] Wed, 18 January 2012 16:47 Go to previous messageGo to next message
Eclipse UserFriend
You don't need any of that, just add a LocationListener to the Browser
and in its changing() implementation set the event's "doit" field to
indicate whether the navigate should be allowed to proceed. For
example, the listener below vetos alternating navigation attempts:

browser.addLocationListener(new LocationAdapter() {
int counter = 0;
public void changing(LocationEvent event) {
event.doit = (counter++ % 2) == 0;
System.out.println("allowing navigate to: " + event.location +
"? " + event.doit);
}
});

Grant


On 1/18/2012 12:10 PM, Missing name Mising name wrote:
> So, I decided to just see what I get when I call Browser.getWebBrowser().
> null.
>
> So, apparently RCP doesn't even support this anymore, and it's just not
> documented.
>
Re: Limit Browser use of external URL's? [message #780972 is a reply to message #780033] Wed, 18 January 2012 10:53 Go to previous messageGo to next message
Eclipse UserFriend
It looks like I would need to use XPCom - but it also appears that XPCom is no longer supported by Mozilla.
See: https://developer.mozilla.org/en/JavaXPCOM/Embedding_Mozilla_in_a_Java_Application_using_JavaXPCOM

So, if XPCom is no longer supported, what SHOULD I be using?
Re: Limit Browser use of external URL's? [message #780982 is a reply to message #780585] Wed, 18 January 2012 16:47 Go to previous messageGo to next message
Eclipse UserFriend
You don't need any of that, just add a LocationListener to the Browser
and in its changing() implementation set the event's "doit" field to
indicate whether the navigate should be allowed to proceed. For
example, the listener below vetos alternating navigation attempts:

browser.addLocationListener(new LocationAdapter() {
int counter = 0;
public void changing(LocationEvent event) {
event.doit = (counter++ % 2) == 0;
System.out.println("allowing navigate to: " + event.location +
"? " + event.doit);
}
});

Grant


On 1/18/2012 12:10 PM, Missing name Mising name wrote:
> So, I decided to just see what I get when I call Browser.getWebBrowser().
> null.
>
> So, apparently RCP doesn't even support this anymore, and it's just not
> documented.
>
Re: Limit Browser use of external URL's? [message #781106 is a reply to message #780970] Fri, 20 January 2012 09:47 Go to previous message
Eclipse UserFriend
That only covers Navigating to a different page.
It does NOT over loading content from other sources.
(Yes, I've already tried it.)
Previous Topic:Re: Port RCP Application to Juno - startup error
Next Topic:Cant find FindReplaceDocumentAdapterContentProposalProvider
Goto Forum:
  


Current Time: Wed Jul 02 22:30:24 EDT 2025

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

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

Back to the top