refactor: 优化移动端判断逻辑并添加 UA 日志输出
- 移除了对 iPad 和 iPod 的判断,只保留 iPhone 和 Android- 在判断移动端之前添加了 UA 日志输出,便于调试
This commit is contained in:
@@ -95,9 +95,9 @@ $('.moments-link').on('click', function (e) {
|
|||||||
|
|
||||||
// 获取链接地址
|
// 获取链接地址
|
||||||
var url = $(this).attr('href');
|
var url = $(this).attr('href');
|
||||||
|
console.log("当前用户UA-", navigator.userAgent)
|
||||||
// 判断是否是移动端
|
// 判断是否是移动端
|
||||||
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
var isMobile = /iPhone|Android/i.test(navigator.userAgent);
|
||||||
|
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
// 移动端:直接跳转
|
// 移动端:直接跳转
|
||||||
|
|||||||
Reference in New Issue
Block a user