PhoneGap和Windows Phone 8上的外部链接 [英] PhoneGap and External Links on Windows Phone 8

查看:134
本文介绍了PhoneGap和Windows Phone 8上的外部链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Phonegap在Windows Phone 8上设置电子商店应用程序。当客户选择要购买的物品时,他应该被带到Paypal窗口,在那里他们可以购买(此应用程序不需要购物车功能)。

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).

d喜欢在手机上的本地浏览器中打开的链接,而不是在应用程序内。我的代码中有以下内容:

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>

但是,这不工作。现在发生的是,客户进入应用程序内的设备上的Paypal屏幕,进行购买,然后Paypal尝试将客户重定向到应用程序的一部分的 index.html ,它显然没有找到。理想情况下,我想PayPal重定向到一个页面,是应用程序的一部分,但我不知道这是否可能。

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.

推荐答案

安装inAppBrowser插件

Install inAppBrowser Plugin

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

然后使用

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

_system > _blank

_system instead of _blank

这篇关于PhoneGap和Windows Phone 8上的外部链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆