簡體   English   中英

Phonegap / Cordova InAppBrowser無法啟動

[英]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開始的工作方式)。

您可以確認以下所有內容嗎?

  • InAppBrowser插件在/#myapp#/platforms/#platform#/www/cordova_plugins.js文件中有一個條目嗎?
  • InAppBrowser插件文件夾位於/#myapp#/ platforms /#platform#/ plugins /
  • InAppBrowser的相關SRC文件也位於platform文件夾中(例如,IOS插件src文件為:/#myapp#/ platforms /#platform#/#appname#/ Plugins /)

另外,如果以上所有內容均得到確認,但仍然不走運,您可以嘗試將console.log('inappbrowser.js文件已加載!')行添加到inappbrowser.js文件的末尾,以確認它確實已加載(假設您已經設置調試控制台並可以查看輸出)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM