Javascript 页面重定向在Chrome和Safari中有效,但在FireFox中无效

Javascript 页面重定向在Chrome和Safari中有效,但在FireFox中无效,javascript,angular,paypal,Javascript,Angular,Paypal,我有一个angular2应用程序。我集成了PayPal沙盒,用于测试it中的在线支付,它在Safari和Chrome中运行良好,但在Firefox中不起作用 问题是: 在我的请求被PayPal批准后,我将页面重定向到他们的付款页面 捐赠组件。ts- this.paypalService.makePaymentRequest(500, 'http://' + rootUrl + '/event/1/home').subscribe(data => { window.location

我有一个angular2应用程序。我集成了PayPal沙盒,用于测试it中的在线支付,它在Safari和Chrome中运行良好,但在Firefox中不起作用

问题是:

在我的请求被PayPal批准后,我将页面重定向到他们的付款页面

捐赠组件。ts-

this.paypalService.makePaymentRequest(500, 'http://' + rootUrl + '/event/1/home').subscribe(data => { 
    window.location.href = data.json.links[1].href;
})
贝宝api服务.ts-

makePaymentRequest(amount: number, redirectUrl: string) {
    var headers = new Headers({ 'Content-Type': 'application/json' });
    headers.append('Authorization', 'Bearer ' + this.TOKEN);

    var options = new RequestOptions({
        headers: headers
    });
    var body = JSON.stringify({
        "intent": "sale",
        "redirect_urls": {
            "return_url": redirectUrl,
            "cancel_url": "http://example.com/your_cancel_url.html"
        },
        "payer": {
            "payment_method": "paypal"
        },
        "transactions": [
            {
                "amount": {
                    "total": amount,
                    "currency": "USD"
                }
            }
        ]
    });
    var requestoptions = new RequestOptions({
        method: RequestMethod.Post,
        url: 'https://api.sandbox.paypal.com/v1/payments/payment/',
        headers: headers,
        body: body
    })
    return this.http.request(new Request(requestoptions))
        .map((res: Response) => {
            if (res) {
            return { status: res.status, json: res.json() }
            }
    }).catch(this.handleError);
}
这里,
data.json.links[1].href
中的URL类似于-

这在Safari和Chrome中可以正常工作。但在firefox中,它只是刷新我的页面。我确实在底部看到一个栏,上面简短地写着“等待sandbox.paypal.com”,但不到一秒钟页面就会刷新

我也尝试过使用
window.location.replace()
重定向,但它不起作用

编辑:


这适用于windows上的FireFox,但不适用于Mac。

您能稍微扩展一下代码吗。这次订阅之后你在做什么?与页面重新加载相关的任何内容?订阅后不执行任何操作。不知道是否相关,但我添加了makePaymentRequest()的代码。我正在将重定向URL传递到PayPal API。成功付款后,PayPal将我的页面重定向到我传递给它的URL。你能稍微扩展一下你的代码吗。这次订阅之后你在做什么?与页面重新加载相关的任何内容?订阅后不执行任何操作。不知道是否相关,但我添加了makePaymentRequest()的代码。我正在将重定向URL传递到PayPal API。成功付款后,PayPal将我的页面重定向到我传递给它的URL。