简体   繁体   English

Windows Phone 8上的PhoneGap和外部链接

[英]PhoneGap and External Links on Windows Phone 8

I'm trying to set up an e-store application on Windows Phone 8 using Phonegap. 我正在尝试使用Phonegap在Windows Phone 8上设置电子商店应用程序。 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). 客户选择要购买的商品时,应将其带到可以在其中进行购买的Paypal窗口(此应用程序不需要购物车功能)。

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. 现在发生的情况是,客户进入应用程序内设备上的“贝宝”屏幕,进行了购买,然后贝宝尝试将客户重定向到应用程序一部分的index.html ,但显然找不到。 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. 理想情况下,我希望Paypal重定向到该应用程序的页面,但是我不确定是否可行。

Install inAppBrowser Plugin 安装inAppBrowser插件

http://cordova.apache.org/docs/en/3.3.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser 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 _system而不是_blank

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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