Page 1 of 1

Open link in new window/other browser

Posted: Wed May 08, 2013 8:12 am
by w

How can I make a link open in a completely new window or external browser, instead of in the native app container (which is basically a browser wrapped in a native container)?
Because in my application, when I click an external link, it opens in the app window itself. Then when I go back, all dynamic fields in my app are gone. Only static labels etc are still there, but all dynamically generated grids, select menus etc. that depend on a service are empty. Also I think the sessionstorage is cleared.
So that's why I want to open links in an external browser or new window.


Open link in new window/other browser

Posted: Wed May 08, 2013 8:18 am
by Oleg Danchenkov

Try childBrowser plugin.
precodefunction windowOpen(url) {
var cb;
if(window.plugins) {
cb = window.plugins.childBrowser;
}
if (cb != null) {
cb.showWebPage(url);
}
else {
window.open(url);
};
}

windowOpen("http://appery.io/");
/code/pre


Open link in new window/other browser

Posted: Wed May 08, 2013 8:36 am
by w

window.open works perfectly. Thanks Oleg!


Open link in new window/other browser

Posted: Mon Mar 17, 2014 11:53 pm
by Erwin Oliva

Hello,
I am using the UI component LINK to map my REST service results to a Google Map Info Window. When the LINK component is clicked it opens up on the current window.

I am not sure how I can use the above scripts to allow opening of the LINK on a new window. Does the above script require that I store data in local storage and then use the click event to launch a javascript instead? Is there a way that the LINK UI component be configured to automatically open on a new window instead?

Would appreciate some help.

Thank you!


Open link in new window/other browser

Posted: Tue Mar 18, 2014 12:19 am
by Igor

Open link in new window/other browser

Posted: Tue Mar 18, 2014 12:28 am
by Erwin Oliva

Hi Igor, Thanks for the suggestion. It seems that using javascript window.open() and navigate to link on click event won't work inside a Google Map info window. I have tested with a simple navigate to link on a click event on an image that I had inside the google map info window, and it won't even recognize that the image is clickable. However, I have a LINK inside the info window, and it does launch the link, but then not on a new window as preferred.
Has anyone tried using window.open or navigate to link from a Google map info window?

Thanks.


Open link in new window/other browser

Posted: Tue Mar 18, 2014 12:37 am
by Erwin Oliva

Hi again Igor. Let me correct myself. I have successfully tested window.open on an image inside a google map info window, and it works.


Open link in new window/other browser

Posted: Tue Mar 18, 2014 1:00 am
by Erwin Oliva

I ended up using a label to map the url inside an info window in google map.
On click of the label, I invoked window.open(Appery('urllabel').text())

Cheers.