Hi,

I am able to link a button to a URL, however it opens in the app. I would like the link to be opened in the phone's application browser instead, is there a way to achieve this?

Thanks.

Regards,
Jerome

Solution

Hi Jerome

You can use this plugin to open either in-app or to redirect to the default browser


Hope this helps!

  -CLSJ

Solution

Hi Jerome,

There's no need to use a plugin just to achieve this. You can use a JavaScript element in your click handler with the following script:

window.open('https://www.google.com', '_system');

This opens the URL in the device's browser.

Aurelio Junior wrote:

Hi Jerome,

There's no need to use a plugin just to achieve this. You can use a JavaScript element in your click handler with the following script:

window.open('https://www.google.com', '_system');

This opens the URL in the device's browser.

hi Aurelio

Do u have an working example of it. 

i need to implement it in my mobile application but currently my links are opening inside my app.


Hi Nitesh,

Just follow these steps:

  • Add a Client Action to handle your link's On Click event.
  • Add a JavaScript element to the new Client Action.
  • Use the following code for the JavaScript element:
    window.open('<yourURL>', '_system');

Aurelio Junior wrote:

Hi Nitesh,

Just follow these steps:

  • Add a Client Action to handle your link's On Click event.
  • Add a JavaScript element to the new Client Action.
  • Use the following code for the JavaScript element:
    window.open('<yourURL>', '_system');

Hi Aurelio,

I have used the above JavaScript, the link is navigating to external browser, But the URL is attached with the outsystems personal link.

We need append the URL with https, If the website is just google.com then it will not work



Aurelio Junior wrote:

Hi Jerome,

There's no need to use a plugin just to achieve this. You can use a JavaScript element in your click handler with the following script:

window.open('https://www.google.com', '_system');

This opens the URL in the device's browser.

I think there is no meaning for "_system" in window.open(), it just works as an overload with window name (https://www.w3schools.com/jsref/met_win_open.asp). But cordova InAppBrowser (if you use it) knows this keyword as a command to start the system browser.

window.open() works, but it opens the page still inside of the mobile app, which means, in particular, that download will not work. I can also see that if I go to tasks in Android - there is no separate browser there, just the mobile app. Or is this really working differently for you?

I was desperately looking for a way to download a file or at least open a page which can download, without adding a plugin. Unfortunately I came to a conclusion that it's not possible.


Igor Kirtak wrote:

Aurelio Junior wrote:

Hi Jerome,

There's no need to use a plugin just to achieve this. You can use a JavaScript element in your click handler with the following script:

window.open('https://www.google.com', '_system');

This opens the URL in the device's browser.

I think there is no meaning for "_system" in window.open(), it just works as an overload with window name (https://www.w3schools.com/jsref/met_win_open.asp). But cordova InAppBrowser (if you use it) knows this keyword as a command to start the system browser.

window.open() works, but it opens the page still inside of the mobile app, which means, in particular, that download will not work. I can also see that if I go to tasks in Android - there is no separate browser there, just the mobile app. Or is this really working differently for you?

I was desperately looking for a way to download a file or at least open a page which can download, without adding a plugin. Unfortunately I came to a conclusion that it's not possible.


I have placed my Javascript with _system, however it still opens a page inside the app, what do I do wrong?


I spent hours to get this done properly. It seems that the Cordova Inappbrowser is the only solution here.

First, install Cordova InAppBrowser:

cordova plugin add cordova-plugin-inappbrowser

Then replace the  `window.open`  (this step is not necessary, but it makes things simplier)

window.open = cordova.InAppBrowser.open;

Then you can call:

<a href="https://google.com" onclick="window.open('https://google.com', '_system'); return false;">Google</a>

This will open Google in device's browser. The `return false;` is important, otherwise the target URL will be opened in webview as well.

I have written more detailed blog article about the issue here

Carlos López Santibáñez Jácome wrote:

Hi Jerome

You can use this plugin to open either in-app or to redirect to the default browser


Hope this helps!

  -CLSJ


how can i use this plugin??

Hi Rashed,


Install the in app browser plugin, pass the URL to the "OPEN" client action available in the in- app browser plugin and set the target to "System".

Hope this will help you.

Regards,

Koushik Prathi

Hi all ,

I have spent a lot of time for solution, when i had this use case to open url outside the application i.e. default browser set for phone to open links. 

Pls try this :

1. Have an external link in ur flow with a "URL" as input parameter like below.



2. Select external url on the onclick property of link and replace <your destination url> (without < > ofcourse) with url destination url as input as shown below , dont forget to mention "external: " before the link.



Please let me know if that works.. 


Regards, 

Nitesh Ahirwar