[英]InAppBrowser Not Working with Phonegap Build
I am trying to use the InAppBrowser plugin with Phonegap Build but when I click on my link, the web page does not open in the InAppBrowser. 我试图将InAppBrowser插件与Phonegap Build一起使用,但是当我单击链接时,网页无法在InAppBrowser中打开。 I can remove the plugin from the config.xml and it does not make a difference.
我可以从config.xml中删除该插件,并且没有什么区别。 I have used the following plugin in my config.xml file.
我在config.xml文件中使用了以下插件。
<gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" />
Below is my code to open the InAppBrowser in my js file. 下面是在我的js文件中打开InAppBrowser的代码。 I am using window.open to call the InAppBrowser and using google as a test.
我正在使用window.open调用InAppBrowser,并使用google作为测试。 Does anyone know what I am doing incorrectly?
有人知道我在做什么吗? Any help is greatly appreciated.
任何帮助是极大的赞赏。
$(document).ready(function() {
var listHtml = "";
var url = "http://example.com/mypage.php"
$.post(url, function(response) {
var json = $.parseJSON(response);
$.each(json, function(key, value) {
listHtml += "<li><a href='#' onclick=window.open('http://www.google.com','_blank','location=yes,toolbar=yes')><img class='ui-circle ui-mini ui-padding' src='" + value.image + "'><h2>" + value.name + "</h2><p><strong>" + value.title + "</strong></p><p><strong>" + value.date + "</strong></p></li>";
$("#history").html(listHtml);
$('ul').listview('refresh');
}); //end list
I think you need to bind window.open
to cordova.InAppBrowser.open
, see documentation here . 我认为您需要将
window.open
绑定到cordova.InAppBrowser.open
,请参阅此处的文档。
$(document).ready(function(){
window.open = cordova.InAppBrowser.open; // BIND
var listHtml = "";
var url = "http://example.com/mypage.php"
$.post(url, function(response){
var json = $.parseJSON(response);
$.each(json, function(key, value){
listHtml += "<li><a href='#' onclick=window.open('http://www.google.com','_blank','location=yes,toolbar=yes')><img class='ui-circle ui-mini ui-padding' src='"+ value.image +"'><h2>" + value.name + "</h2><p><strong>"+ value.title + "</strong></p><p><strong>" + value.date +"</strong></p></li>";
$("#history").html(listHtml);
$('ul').listview('refresh');
});
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.