2016-07-28 116 views
0

APK文件如何關閉inappbowoser科爾多瓦

<a class='btn btn-primary' onclick="window.open('http://somedomain/payment.php', '_system', 'location=yes');" >Payment</a> 

Paymnet.php文件

<div class="login-wrap"> 
    <div class="login-html"> 
     <input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab"></label> 
     <input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab"></label> 
     <div class="login-form"> 
      <form action="" method="post" class="sign-in-htm"> 
     <input type="hidden" name="furl" value=""> 
      <input type="hidden" name="surl" value=""> 

       <div class="group"> 
        <label for="name" class="label">Name</label> 
        <input id="name" name="fullname" type="hidden" class="input" value=""> 
       </div> 
           <div class="group"> 
        <label for="email" class="label">Email</label> 
        <input id="email" name="email" type="hidden" class="input" value=""> 
       </div> 
<div class="group"> 
        <label for="email" class="label">Price</label> 
        <input type="hidden" name="amount" value=""> 
       </div> 

       <div class="group"> 
        <input type="submit" class="button" value="Submit" name="submit"> 
       </div> 



      </form> 

     </div> 
    </div> 
</div> 
<?php 
require "instamojo.php"; 
if(isset($_POST['submit'])){ 
$api = new Instamojo\Instamojo('token', 'api', 'https://test.instamojo.com/api/1.1/'); 

$name=$_POST['fullname']; 
$amount=$_POST['amount']; 
$email=$_POST['email']; 


    try { 
     $response = $api->paymentRequestCreate(array(
      "purpose" => 'h-fm', 
      "name" => $_POST['fullname'], 
      "amount" => $_POST['amount'], 
      "send_email" => false, 
      "email" => $_POST['email'], 
      "redirect_url" => "http://test.com/" 
      )); 
     // print_r($response); 
     $redirect=$response['longurl']; 

?> 
     <script type="text/javascript"> 
      window.location.href = "<?php echo $redirect;?>" ; 

</script> 

    <?php } 
    catch (Exception $e) { 
     print('Error: ' . $e->getMessage()); 
    } 
    } 
    ?> 

如何從Web應用程序重定向到移動應用程序。付款工作正常。我想給關閉按鈕。我試過window.close。它不工作。我試過ref.close()。它不工作。請幫我解決這個問題。

+0

你不能重定向到移動app.You可以從移動應用重定向到您的Web應用程序。 –

回答

0

只需使用inappbrowser插件的close()函數,它就可以關閉應用程序。

var ref = cordova.InAppBrowser.open('http://unitedwaymassbay.org/', '_blank', 'location=no'); 
ref.close(); 

這裏的功能參考,請閱讀inappbrowser