[英]Phonegap/Cordova InAppBrowser not launching
我不确定为什么,但是在执行以下操作时
<img id="buttons" src="https://qikout.com/apppics/MerchantPromo.png" style="margin:1% auto; width:99% !important;" onclick="openextlink('https://qikout.com');"/>
function openextlink(url)
{
var ref = window.open(url, '_blank', 'location=no');
//window.plugins.childBrowser.showWebPage(url, { showLocationBar: true });
}
它工作正常。 但是,当我想从另一个函数中运行openextlink时,它不会打开窗口,而是会加载页面,但不会显示给用户。
例如
function scan(){
window.plugins.barcodeScanner.scan( function(result) {
if(result.format != "QR_CODE")
{
alert("That is not a valid google Tag");
}
else
{
n = result.text.split(".com/");
loadpet();
//alert("We got a barcode\n" +
// "Result: " + result.text + "\n" +
// "Format: " + result.format + "\n" +
// "Cancelled: " + result.cancelled);
}
}, function(error) {
alert("Scanning failed: " + error);
}
);
}
function loadpet(){
$("#buttons").trigger("click");
var link = "http://www.google.com/" + n[1];
openextlink(link);
}
它通过
<div onclick="scan();" class="menu-right"></div>
基本上,它扫描正常,它得到结果,将结果移到loadpet函数,甚至将其发送到openextlink函数,但是不会弹出查看器。
您的window.open代码看起来正确(基于InAppBrowser从Cordova 3.0开始的工作方式)。
您可以确认以下所有内容吗?
另外,如果以上所有内容均得到确认,但仍然不走运,您可以尝试将console.log('inappbrowser.js文件已加载!')行添加到inappbrowser.js文件的末尾,以确认它确实已加载(假设您已经设置调试控制台并可以查看输出)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.