過去常透過 navigator.platform 判斷 Win、Mac、Linux 等平台,再導向電腦版或行動版頁面。
var system = {
win: false,
mac: false,
xll: false
};
var p = navigator.platform;
system.win = p.indexOf('Win') === 0;
system.mac = p.indexOf('Mac') === 0;
system.xll = p === 'X11' || p.indexOf('Linux') === 0;
if (system.win || system.mac || system.xll) {
window.location.href = 'https://hovertree.com/url/?h=https://hovertree.net/';
} else {
window.location.href = './appweb.html';
}
實務上仍建議搭配 User-Agent、視窗寬度與功能偵測,避免單一判斷造成誤導。