Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsNew Platform Browser from Browser Widget
https://www.eclipse.org/forums/index.php/mv/msg/142650/449197/#msg_449197
I'm trying to figure out how to cause a new platform specific browser to
launch when the user clicks on a link that results in a new window to be
normally shown in the Browser widget.
Currently, new windows targets are ignored in HTML HREF tags, but I'm keen
to cause a new version of IE (or Netscape whatever) to be opened.
Is that kind of API being considered ?
Grant]]>Grant Slender2005-01-19T09:12:23-00:00Re: New Platform Browser from Browser Widget
https://www.eclipse.org/forums/index.php/mv/msg/142650/449268/#msg_449268
org.eclipse.swt.browser.WindowEvent. This event is used to handle new window
requests with the SWT Browser. Application needs to handle these events to
support commands like href target="_blank" or javascript window.open.
Or are you asking for something else?
Chris]]>Christophe Cornu2005-01-19T21:51:56-00:00Re: New Platform Browser from Browser Widget
https://www.eclipse.org/forums/index.php/mv/msg/142650/449279/#msg_449279
I'm aware of what you are describing - that does allow you to see the new
window events.
From this, I want to be able to tell the underlying OS to launch a system
browser window from this event.
Whilst I could create a new Shell and place a browser in it, I don't want to
emulate the entire IE browser - for situations where the underlying Browser
widget should show a normal OS browser, I would like to let that launch
occur and present as normal.
Thanks for any feedback or suggestions...
Regards,
Grant
"Christophe Cornu" <christophe_cornu@ca.ibm.com> wrote in message
news:csmkqm$rei$1@www.eclipse.org...
> If I understand your question correctly: you can look into the javadoc for
> org.eclipse.swt.browser.WindowEvent. This event is used to handle new
> window requests with the SWT Browser. Application needs to handle these
> events to support commands like href target="_blank" or javascript
> window.open.
>
> Or are you asking for something else?
>
> Chris
>]]>Grant Slender2005-01-20T05:30:30-00:00Re: New Platform Browser from Browser Widget
https://www.eclipse.org/forums/index.php/mv/msg/142650/449291/#msg_449291
If you are willing to experiment, here is a - poor - hack below.
Program.launch is used to access an external native viewer (IE ..). It is
inefficient - document gets loaded twice - and fragile - Program.launch
could fail or be passed unsupported content. If you own the HTML content you
could verify it works in your situation otherwise it's probably wise not to
use it. To try the example below, go to a link that opens up in a new window
or right click and select "open in a new window" if you are on Windows.
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setText("PRBrowser");
shell.setLayout(new FillLayout());
final Shell hiddenShell = new Shell(display);
final Browser hiddenBrowser = new Browser(hiddenShell, SWT.NONE);
hiddenBrowser.addVisibilityWindowListener(new VisibilityWindowListener() {
public void hide(WindowEvent e) {
}
public void show(WindowEvent e) {
/* ignore pop-ups and other windows with no all attributes */
if (e.addressBar && e.menuBar && e.statusBar && e.toolBar) {
hiddenBrowser.setData("EXTERNAL", "true");
}
}
});
hiddenBrowser.addLocationListener(new LocationListener() {
public void changing(LocationEvent event) {
}
public void changed(LocationEvent event) {
if (!event.top) return;
if (hiddenBrowser.getData("EXTERNAL") != null) {
hiddenBrowser.setData("EXTERNAL", null);
Program.launch(event.location);
}
}
});
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
hiddenShell.close();
display.dispose();
}
}]]>Christophe Cornu2005-01-20T16:49:33-00:00Re: New Platform Browser from Browser Widget
https://www.eclipse.org/forums/index.php/mv/msg/142650/449458/#msg_449458
http://browserlauncher.sourceforge.net/ is probably
what you want to start the system default browser.
Grant Slender wrote:
> Chris,
>
> I'm aware of what you are describing - that does allow you to see the new
> window events.
>
> From this, I want to be able to tell the underlying OS to launch a system
> browser window from this event.
>
> Whilst I could create a new Shell and place a browser in it, I don't want to
> emulate the entire IE browser - for situations where the underlying Browser
> widget should show a normal OS browser, I would like to let that launch
> occur and present as normal.
>
> Thanks for any feedback or suggestions...
>
> Regards,
>
> Grant
>
> "Christophe Cornu" <christophe_cornu@ca.ibm.com> wrote in message
> news:csmkqm$rei$1@www.eclipse.org...
>
>>If I understand your question correctly: you can look into the javadoc for
>>org.eclipse.swt.browser.WindowEvent. This event is used to handle new
>>window requests with the SWT Browser. Application needs to handle these
>>events to support commands like href target="_blank" or javascript
>>window.open.
>>
>>Or are you asking for something else?
>>
>>Chris
>>
>
>
>]]>Bernhard Fastenrath2005-01-24T20:12:00-00:00