在 React.js + react-router + Flux 应用程序中,如何将某人发送出应用程序?
In a React.js + react-router + Flux app, how do I send someone out of the app?
我有一个注销功能,可以从我的应用程序中清除所有状态。然后我希望它将客户发送到营销网站,该网站托管在不同域的不同堆栈中。
browserHistory 没有执行此操作的功能。
是否有功能,或者我应该只使用 location.href?
您必须对此类事情使用 location.href
,因为您基本上需要将整个页面重新加载到不同的域。
你不能用 browserHistory 来做到这一点,因为它使用 HTML5 历史 API pushState
、replaceState
和 popstate
在引擎盖下(在 https://github.com/mjackson/history repo) and this isnt supported in the spec: https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState%28%29.C2.A0method
The new URL must be of the same origin as the current URL; otherwise,
pushState() will throw an exception
我有一个注销功能,可以从我的应用程序中清除所有状态。然后我希望它将客户发送到营销网站,该网站托管在不同域的不同堆栈中。
browserHistory 没有执行此操作的功能。
是否有功能,或者我应该只使用 location.href?
您必须对此类事情使用 location.href
,因为您基本上需要将整个页面重新加载到不同的域。
你不能用 browserHistory 来做到这一点,因为它使用 HTML5 历史 API pushState
、replaceState
和 popstate
在引擎盖下(在 https://github.com/mjackson/history repo) and this isnt supported in the spec: https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState%28%29.C2.A0method
The new URL must be of the same origin as the current URL; otherwise, pushState() will throw an exception