如何在手机上更改域名?
How to make domain change on mobile?
我的问题是,我怎样才能做到,当有人通过手机进入一个域时 phone 他们会被定向到另一个域 。
以 Twitter 为例,如果我们在 phone 上的浏览器中输入 https://twitter.com it will automatically direct to https://mobile.twitter.com
在 vanilla JS 中,只需在 DOM 加载事件后进行条件检查。
if( /Android|webOS|iPhone|iPad|Mac|Macintosh|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
window.location.replace('mobileurl');
/// or window.location.href = 'mobileurl';
}
我的问题是,我怎样才能做到,当有人通过手机进入一个域时 phone 他们会被定向到另一个域 。 以 Twitter 为例,如果我们在 phone 上的浏览器中输入 https://twitter.com it will automatically direct to https://mobile.twitter.com
在 vanilla JS 中,只需在 DOM 加载事件后进行条件检查。
if( /Android|webOS|iPhone|iPad|Mac|Macintosh|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
window.location.replace('mobileurl');
/// or window.location.href = 'mobileurl';
}