sqlchild
sqlchild

Reputation: 9064

going back to android app from window.open browser

I have posted a form to on online url in my phonegap app. The online url opens in the app and it shows me the posted data. But now how do I go back to my app using some link etc. I am using the following code but in vain :

showdata.php

 <?php



var_dump($_POST);


?>

//this doesn't works
<a onclick="close(); return false;">Close me</a>

in my app index.html :

   <form action="http://mywebsite.com/showdata.php" id=dataform">

 <input type="text" value="itemname" value="CPU">

</form>

<script>    

    document.getElementById('dataform').submit();

</script>

UPDATE :

<script type="text/javascript">
                                            var mapForm = document.getElementById("dataform");

                                            var map=cordova.InAppBrowser.open("","_blank","location=yes");

                                            if (map) 
                                            {

                                                document.getElementById("dataform").submit();

                                            } 
                                            else 
                                            { 

                                                alert('You must allow popups for this map to work.');

                                            }




                                         </script>

Upvotes: 0

Views: 2512

Answers (1)

proofzy
proofzy

Reputation: 637

You can use inappbrowser cordova plugin.

Here is example of code:

<script type="text/javascript" charset="utf-8">
                 // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);

// device APIs are available
//
function onDeviceReady() {
    window.open('http://paypal.me/xxxzzzyyy/5', '_blank', 'location=yes');
}

</script>

You can also call link onclick and there is close button which makes you back to app.

Upvotes: 1

Related Questions