我正在尝试将我的Angular2应用程序重定向到我的OAuth2身份验证服务器登录页面。这意味着我必须重定向到外部URL。我已经测试过了:
this.router.navigate(["/"]).then(result=>{window.location.href = 'http://external-url';});这在Firefox中有效,但在Chrome中不起作用。有没有更好的方法来做这件事?window.location.href是我能找到的唯一解决方案。
发布于 2017-04-28 16:10:25
我也遇到过类似的问题。对我来说,重定向在Chrome中有效,在Firefox中不起作用。尝试使用以下代码:
window.location.assign(http://external-url);
https://stackoverflow.com/questions/40324705
复制相似问题