gpt4 book ai didi

javascript - 如何使用 html 将 Windows Phone(但不是桌面 Windows)重定向到移动网站?

转载 作者:行者123 更新时间:2023-11-27 23:19:24 25 4
gpt4 key购买 nike

我使用移动设备重定向已经有一段时间了,但令我烦恼的是(据我所知)Windows Phone 用户没有被重定向。

我的问题是,如何重定向 Windows Phone 用户?

我的代码:

<script>
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) )
{ window.location = "http://m.ctworkshop.us/"; }
</script>

这可能吗?如果是的话,我会添加什么名称来执行此操作?

诗。将“Windows”添加到该列表会重定向桌面 Windows,这是我不想做的。

最佳答案

怎么样

navigator.userAgent.match(/Windows Phone/i)

这是一个blog post from a Microsoft employee关于正确检测使用相同策略的 Windows 手机。

关于javascript - 如何使用 html 将 Windows Phone(但不是桌面 Windows)重定向到移动网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35514157/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com