繁体   English   中英

自动重定向到 javascript 中的另一个站点

[英]Redirecting automatically to another site in javascript

我有一个网站,有移动版和桌面版。 但我想以某种方式将它们连接到桌面站点是默认登录页面的地方。 因此,如果视口的宽度小于 600px(例如),它会自动重定向到移动站点(使用不同的域上传)。 我正在使用 React,因此使用 React 的解决方案也可以。 有谁知道如何做到这一点?

// use this to avoid redirects when a user clicks "back" in their browser
window.location.replace('http://somewhereelse.com');

// use this to redirect, a back button call will trigger the redirection again
window.location.href = "http://somewhereelse.com";

欧文已在这个问题中回答: 自动将某人重定向到另一个网页的最佳方法是什么?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM