[英]going back to android app from window.open browser
I have posted a form to on online url in my phonegap app. 我已经在phonegap应用程序的在线URL上发布了一个表单。 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 showdata.php
<?php
var_dump($_POST);
?>
//this doesn't works
<a onclick="close(); return false;">Close me</a>
in my app index.html : 在我的应用程序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>
You can use inappbrowser cordova plugin. 您可以使用inappbrowser cordova插件。
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. 您还可以调用链接onclick,并且有一个关闭按钮可以使您返回应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.