InAppBrowser不工作与Phonegap构建



我试图使用InAppBrowser插件与Phonegap构建,但当我点击我的链接,网页不打开InAppBrowser。我可以从config.xml中删除插件,这并没有什么区别。我在config.xml文件中使用了以下插件:

<gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" />

下面是我在js文件中打开InAppBrowser的代码。我正在使用窗口。打开调用InAppBrowser,并使用google作为测试。有人知道我做错了什么吗?非常感谢任何帮助。

$(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

我认为您需要将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');
        });
    });
});

最新更新