Inappbrowser using Phonegap build

2

I have an application that runs on mobile compiled in PG build Cli 5.2.0 in this app I have some external links to open. I implemented the inappbrowser to be able to close the open browser and return to the app. however there are several different links. Is there any way I can do a function without the specific link and just specify on the button when I'm calling the function? so I do not have to do a function for each different link. Ex: what I'm using.

<head>
    <!-- o script esta rodando no cabeçalho -->
    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    function face() {
         var ref = window.open('http://facebook.com', '_blank', 'location=yes');
    }

    </script>

<body>

The button stays in the body of the app and needs to have several buttons of that with different links ...

   <li><button onclick="face()">Pagina do face</button></li>
    
asked by anonymous 07.07.2016 / 17:27

1 answer

0

You can use the same function but pass the link you want to open as an argument.

So in HTML you can have:

<li><button onclick="face('http://um.link.com')">Pagina do Um</button></li>
<li><button onclick="face('http://outro.link.com')">Pagina do Outro</button></li>

and the function looks like this:

function face(meuLink) { 
    window.open(meuLink, '_blank', 'location=yes'); 
}

I called meuLink to the variable, but you can give whatever name you want.

    
07.07.2016 / 19:20