简体   繁体   中英

How to open browser on a button click event of a Phonegap Apps

我们有一个使用HTML和JavaScript的PhoneGap应用程序。我们希望在应用程序的按钮单击事件中访问PayPal网站,并在付款后恢复为应用程序。我们如何做到这一点?

There is one inapp browser event in phonegeap you can use that like below,

  Ref = window.open(url,'_blank','location=no');
  Ref.addEventListener('loadstart', LoadStart);
  Ref.addEventListener('loadstop', LoadStop);
  Ref.addEventListener('exit', Close);

Use function like this you will get callback event. On that remove event.

Close = function(event){
       console.log("app "+event.type + ' - ' + event.url);
       iabRef.removeEventListener('loadstart', iabLoadStart);
       iabRef.removeEventListener('loadstop', iabLoadStop);
       iabRef.removeEventListener('exit', iabClose);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM