2013-03-02 2 views
2

을 시작하지 나는 확실하지 않다 왜 그러나 내가 할 때 잘 작동폰갭/코르도바 InAppBrowser

<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 기능에 전송 결과를 얻을 작동합니다.

+0

n [1] 내부의 값은 무엇입니까? – Whizkid747

답변

0

귀하의 window.open 코드가 옳습니다 (InAppBrowser가 Cordova 3.0에서 작동하는 방식에 따라).

다음을 모두 확인해 주실 수 있습니까?

  • 가 InAppBrowser 플러그인은 파일 당신의 /#myapp#/platforms/#platform#/www/cordova_plugins.js에 항목이?/# MyApp를 :
  • InAppBrowser 플러그인 폴더 #의 myapp와 번호/플랫폼/# 플랫폼 #의/플러그인/
  • InAppBrowser에 대한 관련 SRC 파일
  • 예를 들어 IOS 플러그인 SRC 파일은 (물론 플랫폼 폴더에 /에서입니다

위의 내용이 모두 확인되었지만 여전히 운이 없다면 console.log를 추가해보십시오. ('inappbrowser.js 파일이로드되었습니다!') #/플랫폼/# 플랫폼 #/# appname #/플러그인 /) 줄을 inappbrowser.js 파일의 끝에 추가하여 실제로로드 중인지 확인합니다 (디버그 콘솔을 설정하고 출력을 볼 수 있다고 가정).