简体   繁体   中英

Paypal hybrid app

I have managed to integrate a donate paypal button in a Cordova app:

<form action='https://www.paypal.com/cgi-bin/webscr' method='post' target='_top'>
  ...
</form>

All works fine except that when the button is pressed, a new window appears and completly covers the app webview making it impossible for the user to go back to the app (the only way is killing the app process), which I think is a very bad user experience.

Things that I've tried:

  • target='_blank' : same result
  • target='myIFrameName' : Cross-domain problem
  • Post the form via ajax and put result in a div: Form must be calculated on the fly error (with $http.put in ionic, haven't tried with jQuery)

Please, any solution?

The best one would be to have the paypal window inside the current webview not covering header, as I could place a back button there (something like iframe solution that could work with cross domain) but also could be with placing a link to go back in the paypal donate page. I haven't investigated deeper enought the paypal plugin at this location: https://github.com/paypal/PayPal-Cordova-Plugin . anyone knows if it could do the work? (I've already opened an issue there asking for this feature)

Why not use a inApp browser ? Cordova InAppBrowser

And call cordova.InAppBrowser.open( url, '_blank', 'location=yes'); on a button click function, or whatever suits you.

_blank = inside the app
_system = system's browser( will redirect you from app ) 

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