Programmatically Request New Page/URL Load in Existing Browser Window/Tab? [message #1746865] |
Sun, 06 November 2016 17:08  |
Eclipse User |
|
|
|
Pardon me if there is an obvious answer to this question, but is there any way in RAP to get something like the effect of programmatically launching an ExternalBrowser on a specified URL, but to have the new page be displayed NOT in a (new) external browser, but rather in the CURRENT browser window/tab?
I think I want the effect of a Link (or an 'a' tag embedded in a Label), but to have it be under program control--generally at the end of handling some event like a button click or menu selection. For instance, a menu action might created a new piece of data, and I want to then load the URL/page for that data.
I realize this is a bit counter to the default RAP assumption of a long-lived single-page web application. Is it doable in RAP?
Thanks for any advice,
--Eric
|
|
|
|
Re: Programmatically Request New Page/URL Load in Existing Browser Window/Tab? [message #1746995 is a reply to message #1746865] |
Tue, 08 November 2016 07:28   |
Eclipse User |
|
|
|
Depending on the the created piece of data, you may also use a Dialog with a Browser widget and show the data in that browser - either by creating the respective html code and set it using Browser#setText or by creating a (temporary) file on the web server and show it using Browser#setUrl.
I think this is quite nice since the application remains visible and the presented content looks like being part of it. Additionally, the user can benefit from the dialog functionality (e.g. resize the dialog or drag it around). And finally, you have access to the browser widget, e.g. to add a ProgressListener or to react on events in the page (see BrowserFunctions). More info about it: [1]
However, this is probably no solution if you want to access external content, since the Browser widget is represented by an iframe and displaying external content in frames may be denied (X-Frame-Options, see [2]) or you may run into issues due to cross-frame-scripting restrictions.
If you create html code during runtime, make sure to test the functionality in all browsers you support.
[1] https://www.eclipse.org/rap/developers-guide/devguide.php?topic=web-embedding.html&version=3.0
[2] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
[Updated on: Tue, 08 November 2016 07:30] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05379 seconds