重定向到应用网址以外的其他网址

时间:2015-10-18 19:37:43

标签: redirect meteor iron-router

我目前正在为我们国家开发基于电子商务的网站。我需要集成本地支付网关解决方案。该系统的体系结构实际上基于REST。因此,我需要post将几个数据发送到特定url,然后他们response返回content另一个url我的应用应重定向到的url。在事务成功/失败/取消后,第三方系统会重定向回我的应用程序URL。

现在我遇到了从我的应用重定向到第三方var result = HTTP.post(url,{params:data_me}); console.log(result.content+' ....'); 的问题。

post

str.replace方法是同步的,我正确地接收了网址。我现在如何将我的应用程序重定向到他们的回复网址。 注意:这些语句是用服务器方法编写的。我正在为我的应用程序使用铁路由器。

2 个答案:

答案 0 :(得分:1)

您可以在客户代码中使用onRendered,最好将其置于location.href="http://example.com"

iron-router

或使用Router.route('/myurl', function () { //do sth var url = "http://example.com" this.response.writeHead(302, { 'Location': url }); this.response.end(); }, { where: 'server' }); 的路由器在服务器端编写重定向标头

>>> full_list = ['first', 'second', 'third', 'fourth', 'fifth']
>>> [element for element in full_list[::2]]
['first', 'third', 'fifth']

答案 1 :(得分:0)

由于您正在服务器上进行集成,因此让服务器方法将新的url返回给客户端。然后在客户端上执行:

 window.location=url;

铁路由器不会将您带到异地网址,因为它只管理内部路由。

docs