// 检测 userAgent(浏览器信息)
!(function () {
const userAgent = navigator.userAgent; // 验证是否为Android或iPhone
const android = userAgent.match(/(Android);?[\s\/]+([\d.]+)?/);
const iphone = userAgent.match(/(iPhone\sOS)\s([\d_]+)/);
// 如果是Android或iPhone,则跳转至移动站点
if (android || iphone) {
location.href = "http://m.goudong.com";
}
})();
JS-webapi-通过 userAgent 检测浏览器的版本及平台
最新推荐文章于 2022-08-02 17:44:21 发布