734
Views
8
Comments
Solved
[InAppBrowser Plugin] Possible to open URL in Javascript?
Forge component by OutSystems R&D
11
Published on 09 Jan 2020

I have a Googlemap with markers that show an infowindow when you click on them.

The infowindow shows some text and a button, that, when clicked on, should open an url with the InAppBrowser, but this does not work.



Any way to get this to work, or another way to open an url in javascript?


Thanks in advance!

Staff
Rank: #45
Solution

The problem is that you don't have the scope of the declared function when you're trying to call it, a javascript node can be considered as a function(){} where you put your code inside.

I noticed that you found a solution, but alternatively, if you want to run some client side logic, you can declare a window object and then call a client action from one of his methods. See below example:


On the info window button click, just call the window object:

onclick="window.InfoWindowNavigationFunction.NavigateOnClick()"


Cheers

Lars De Pauw wrote:

I have a Googlemap with markers that show an infowindow when you click on them.

The infowindow shows some text and a button, that, when clicked on, should open an url with the InAppBrowser, but this does not work.



Any way to get this to work, or another way to open an url in javascript?


Thanks in advance!

Have you tried this?

window.open("www.google.com", windowName, "height=200,width=200");

Staff
Rank: #45
Solution

The problem is that you don't have the scope of the declared function when you're trying to call it, a javascript node can be considered as a function(){} where you put your code inside.

I noticed that you found a solution, but alternatively, if you want to run some client side logic, you can declare a window object and then call a client action from one of his methods. See below example:


On the info window button click, just call the window object:

onclick="window.InfoWindowNavigationFunction.NavigateOnClick()"


Cheers

Rank: #13297

Hi Henrique,


Nice of you to drop by to assist me again!

Using your method:

 I've encountered a different error;


Am I placing the window.function in the wrong place?

Staff
Rank: #45

Uhm, that's strange because I have a running example, actually is exactly like yours (google maps infowindow on click).

The only difference between what I have and yours, is the window function declaration that is made on a previous javascript node.

Not sure if it will solve it though. Let me know if it makes any difference.

Staff
Rank: #45

AHAHAHAH

I'm a great striker :P