InAppBrowser excutescript()方法是不是返回innerHtml代码?

时间:2017-05-05 14:16:18

标签: ionic2 hybrid-mobile-app inappbrowser payu

我正在将payU支付API整合到我的Ionic应用程序中。我能够获得payU的付款成功网址,但InAppBrowser excuteScript()方法没有返回付款成功网址的innerHtml。

请提供相关解决方案。

请在下面找到我的代码。

onDeviceReadyTest(url) {
    console.log('url passed'+ url);

  //let browser = new InAppBrowser(url,'_blank');

  const browser = this.iab.create(url,'_blank');

  browser.on('loadstart').subscribe(
  (res) => {
    // Handle url checking and body parsing here
    console.log('event start with ' + res.url);
   },
   (error) => {
    // Handle error here
    console.log(error);
   }
   );

   browser.on('loadstop').subscribe(
      (res) => {
    // Handle url checking and body parsing here
    console.log('event stop with ' + res.url);
    if(res.url.match("https://payu.herokuapp.com/success")) {
    console.log('event match with ' + res.url);
     //alert( browser.innerHTML);


    browser.executeScript({code:"document.body.innerText"}),
       function(values){

         alert( values[ 0 ] );
         var a = this.getValue(values[0], 'mihpayid');
         var b = this.getValue(values[0], 'status');
         var c = this.getValue(values[0], 'unmappedstatus');
         console.log(a + b + c);//you can capture values from return 

         }
       }
       },
     (error) => {
    // Handle error here
    console.log(error);
      }
    );

  this.iabRef.addEventListener('loadstart', this.iabLoadStart);
  this.iabRef.addEventListener('loadstop', this.iabLoadStop);
  this.iabRef.addEventListener('loaderror', this.iabLoadError);
  this.iabRef.addEventListener('exit', this.iabClose);
  }`

0 个答案:

没有答案