Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Limit Browser use of external URL's?
Limit Browser use of external URL's? [message #780033] Tue, 17 January 2012 03:23 Go to next message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
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 15:53 Go to previous messageGo to next message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
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 16:36 Go to previous messageGo to next message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
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 17:10 Go to previous messageGo to next message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
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 21:47 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
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 15:53 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 59
Registered: July 2009
Member
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 21:47 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
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 14:47 Go to previous message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
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: Fri Dec 04 06:16:41 GMT 2020

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

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

Back to the top