簡體   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