简体   繁体   中英

PhoneGap and External Links on Windows Phone 8

I'm trying to set up an e-store application on Windows Phone 8 using Phonegap. When a customer chooses an item to buy, he should be taken to a Paypal window where they can make their purchase (this application does not need cart functionality).

I'd like the link to be opened in the native browser on the phone and not inside the app. I have the following in my code:

$(document).on("click", ".external-link", function () {
                var link = $(this).attr("href");
                var ref = window.open(link, "_blank", 'location=yes');
            });

And for any external links, I simply add a class to the link, as shown below:

<a class='external-link' href='http://www.example.com'>Buy now!</a>

However, this isn't working. What happens now is that the customer enters the Paypal screen on the device inside the app, makes a purchase, and then Paypal tries to redirect the customer to index.html which is part of the app, which it obviously doesn't find. Ideally, I'd like for Paypal to redirect to a page that is part of the app, but I'm not sure if this is possible.

Install inAppBrowser Plugin

http://cordova.apache.org/docs/en/3.3.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser

Then use this

window.open(link, "_system", 'location=yes');

_system instead of _blank

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