|
@@ -1,4 +1,17 @@
|
|
|
+// export function isPadDevice() {
|
|
|
+// const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
|
+// return /iPad|Tablet|Android|Mobile/i.test(userAgent) && !/Phone/i.test(userAgent);
|
|
|
+// }
|
|
|
export function isPadDevice() {
|
|
|
- const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
|
- return /iPad|Tablet|Android|Mobile/i.test(userAgent) && !/Phone/i.test(userAgent);
|
|
|
- }
|
|
|
+ const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
|
+ const platform = navigator.platform || '';
|
|
|
+ const maxTouchPoints = navigator.maxTouchPoints || 0;
|
|
|
+
|
|
|
+ // 检查是否是iPad
|
|
|
+ if (/MacIntel/.test(platform) && maxTouchPoints > 1) {
|
|
|
+ return true; // iOS 13+ iPad
|
|
|
+ }
|
|
|
+
|
|
|
+ // 其他平板设备检测
|
|
|
+ return /iPad|Tablet|Android|Mobile/i.test(userAgent) && !/Phone/i.test(userAgent);
|
|
|
+}
|