Home » Eclipse Projects » Remote Application Platform (RAP) » How to open a new tab in the same browser RAP is running in?
How to open a new tab in the same browser RAP is running in? [message #123887] |
Fri, 06 March 2009 14:14  |
Eclipse User |
|
|
|
Hello,
my RAP application has some external links, which are opened each in a new
external browser window. Is it possible to open them in a separate tab of
the same browser instance where the RAP application is running in, instead?
(Of course the browser must support tabbed-browsing.) Here is my code:
int style = IWorkbenchBrowserSupport.AS_EXTERNAL |
IWorkbenchBrowserSupport.LOCATION_BAR |
IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.STATUS;
String browserId = String.valueOf(new Random().nextInt(10000));
PlatformUI.getWorkbench().getBrowserSupport()..createBrowser (style,
browserId , "", "").openURL(new URL("http://..."));
Generating a new browserId is required, as applying a constant browserId
just opens one new browser instance and each loaded URLlink gets replaced
there by the next one. But I want all URLs left open.
In HTML <a href="..." target="_blank"> does the job.
Thanks in advance,
Andreas
|
|
|
Re: How to open a new tab in the same browser RAP is running in? [message #123901 is a reply to message #123887] |
Mon, 09 March 2009 04:15   |
Eclipse User |
|
|
|
Originally posted by: bjoern.bjoernfischer.de
Hi Andreas,
I don't know for sure, but IMHO it is a browser option if a new web page
with target _blank is opened in a new window or in a new tab (Firefox at
least has this option). Could be that you can not force the browser to
choose the one or the other way of opening.
Regards,
Björn
Andreas Maier schrieb:
> Hello,
>
> my RAP application has some external links, which are opened each in a new
> external browser window. Is it possible to open them in a separate tab of
> the same browser instance where the RAP application is running in, instead?
> (Of course the browser must support tabbed-browsing.) Here is my code:
> int style = IWorkbenchBrowserSupport.AS_EXTERNAL |
> IWorkbenchBrowserSupport.LOCATION_BAR |
> IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.STATUS;
>
> String browserId = String.valueOf(new Random().nextInt(10000));
>
> PlatformUI.getWorkbench().getBrowserSupport()..createBrowser (style,
> browserId , "", "").openURL(new URL("http://..."));
>
> Generating a new browserId is required, as applying a constant browserId
> just opens one new browser instance and each loaded URLlink gets replaced
> there by the next one. But I want all URLs left open.
> In HTML <a href="..." target="_blank"> does the job.
>
>
> Thanks in advance,
> Andreas
>
>
|
|
|
Re: How to open a new tab in the same browser RAP is running in? [message #123913 is a reply to message #123887] |
Mon, 09 March 2009 04:25   |
Eclipse User |
|
|
|
Hi Andreas,
the RWT-specific class org.eclipse.rwt.widgets.ExternalBrowser does this
job.
Regards,
Stefan.
Andreas Maier schrieb:
> Hello,
>
> my RAP application has some external links, which are opened each in a new
> external browser window. Is it possible to open them in a separate tab of
> the same browser instance where the RAP application is running in, instead?
> (Of course the browser must support tabbed-browsing.) Here is my code:
> int style = IWorkbenchBrowserSupport.AS_EXTERNAL |
> IWorkbenchBrowserSupport.LOCATION_BAR |
> IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.STATUS;
>
> String browserId = String.valueOf(new Random().nextInt(10000));
>
> PlatformUI.getWorkbench().getBrowserSupport()..createBrowser (style,
> browserId , "", "").openURL(new URL("http://..."));
>
> Generating a new browserId is required, as applying a constant browserId
> just opens one new browser instance and each loaded URLlink gets replaced
> there by the next one. But I want all URLs left open.
> In HTML <a href="..." target="_blank"> does the job.
>
>
> Thanks in advance,
> Andreas
>
>
|
|
| |
Re: How to open a new tab in the same browser RAP is running in? [message #123966 is a reply to message #123940] |
Mon, 09 March 2009 05:33   |
Eclipse User |
|
|
|
Hi Roland,
this problem is not RAP specific. The ExternalBrowser#open parameters
are passed to the Javascript function window.open. Instead of "test",
you could experiment with the id's "_blank", "_parent", etc. But it's
still up to the browser to decide whether to open up a new tab or a new
window. There are a many forum threads out there discussing this problem
- maybe you can find anything there.
Best regards,
Ralf
Roland Siebert wrote:
> And how I can open a new tab instead of a new window?
>
> ExternalBrowser.open( "test", "http://www.eclipse.org",
> ExternalBrowser.LOCATION_BAR | ExternalBrowser.NAVIGATION_BAR |
> ExternalBrowser.STATUS );
>
> This opens a new window.
>
> Roland
>
> Stefan Roeck schrieb:
>> Hi Andreas,
>>
>> the RWT-specific class org.eclipse.rwt.widgets.ExternalBrowser does
>> this job.
>>
>> Regards,
>> Stefan.
>
|
|
|
Re: How to open a new tab in the same browser RAP is running in? [message #123991 is a reply to message #123966] |
Mon, 09 March 2009 10:23   |
Eclipse User |
|
|
|
Hi,
I found out that I need this code to open in a new tab:
org.eclipse.rwt.widgets.ExternalBrowser.open( "_blank",
"http://www.eclipse.org", "" );
But ExternalBrowser.open( "_blank", "http://www.eclipse.org", 0 );
generates this code:
org.eclipse.rwt.widgets.ExternalBrowser.open( "_0blank",
"http://www.eclipse.org",
" dependent=1,scrollbars=1,resizable=1,status=1,location=1,too lbar=1,menubar=1 "
);
The method static String escapeId( final String id ) does not accept
"_blank" and replace it with "_0blank".
And the method private static String getFeatures( final int style ) is
setting by default some features.
Can this be fixed?
Roland
Ralf Sternberg schrieb:
> Hi Roland,
>
> this problem is not RAP specific. The ExternalBrowser#open parameters
> are passed to the Javascript function window.open. Instead of "test",
> you could experiment with the id's "_blank", "_parent", etc. But it's
> still up to the browser to decide whether to open up a new tab or a new
> window. There are a many forum threads out there discussing this problem
> - maybe you can find anything there.
>
> Best regards,
> Ralf
>
>
> Roland Siebert wrote:
>> And how I can open a new tab instead of a new window?
>>
>> ExternalBrowser.open( "test", "http://www.eclipse.org",
>> ExternalBrowser.LOCATION_BAR | ExternalBrowser.NAVIGATION_BAR |
>> ExternalBrowser.STATUS );
>>
>> This opens a new window.
>>
>> Roland
>>
>> Stefan Roeck schrieb:
>>> Hi Andreas,
>>>
>>> the RWT-specific class org.eclipse.rwt.widgets.ExternalBrowser does
>>> this job.
>>>
>>> Regards,
>>> Stefan.
|
|
|
Re: How to open a new tab in the same browser RAP is running in? [message #124081 is a reply to message #123991] |
Mon, 09 March 2009 14:15   |
Eclipse User |
|
|
|
Hi Roland,
thanks for pointing this out. Indeed, this escaping of periods seems to
be a problem with _xxx ids. Could you file a bug report for this issue?
Thank you,
Ralf
Roland Siebert wrote:
> Hi,
>
> I found out that I need this code to open in a new tab:
> org.eclipse.rwt.widgets.ExternalBrowser.open( "_blank",
> "http://www.eclipse.org", "" );
>
> But ExternalBrowser.open( "_blank", "http://www.eclipse.org", 0 );
> generates this code:
> org.eclipse.rwt.widgets.ExternalBrowser.open( "_0blank",
> "http://www.eclipse.org",
> " dependent=1,scrollbars=1,resizable=1,status=1,location=1,too lbar=1,menubar=1 "
> );
>
> The method static String escapeId( final String id ) does not accept
> "_blank" and replace it with "_0blank".
>
> And the method private static String getFeatures( final int style ) is
> setting by default some features.
>
> Can this be fixed?
> Roland
>
> Ralf Sternberg schrieb:
>> Hi Roland,
>>
>> this problem is not RAP specific. The ExternalBrowser#open parameters
>> are passed to the Javascript function window.open. Instead of "test",
>> you could experiment with the id's "_blank", "_parent", etc. But it's
>> still up to the browser to decide whether to open up a new tab or a new
>> window. There are a many forum threads out there discussing this problem
>> - maybe you can find anything there.
>>
>> Best regards,
>> Ralf
>>
>>
>> Roland Siebert wrote:
>>> And how I can open a new tab instead of a new window?
>>>
>>> ExternalBrowser.open( "test", "http://www.eclipse.org",
>>> ExternalBrowser.LOCATION_BAR | ExternalBrowser.NAVIGATION_BAR |
>>> ExternalBrowser.STATUS );
>>>
>>> This opens a new window.
>>>
>>> Roland
>>>
>>> Stefan Roeck schrieb:
>>>> Hi Andreas,
>>>>
>>>> the RWT-specific class org.eclipse.rwt.widgets.ExternalBrowser does
>>>> this job.
>>>>
>>>> Regards,
>>>> Stefan.
|
|
| | |
Re: How to open a new tab in the same browser RAP is running in? [message #999310 is a reply to message #124222] |
Fri, 11 January 2013 14:43  |
Eclipse User |
|
|
|
Hi,
Posting to this outdated thread in a hope someone would still need a solution like me today...
ExternalBrowser (of RWT 1.5) does open a URL in a new window. But the code below opens it in a new tab (on my remote Firefox 18.0/Win32 XP at least):
JSExecutor.executeJS("window.open(\"" + url + "\");");
Regards,
Sergei
|
|
|
Goto Forum:
Current Time: Wed Jul 23 10:55:42 EDT 2025
Powered by FUDForum. Page generated in 0.28993 seconds
|