判断是移动还是pc设备
export const isMobile = () => {
if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i))) {
return 'mobile';
}
return 'desktop';
}
判断是苹果还是android移动设备
export const isAppleMobileDevice = () => {
let reg = /iphone|ipod|ipad|Macintosh/i;
return reg.test(navigator.userAgent.toLowerCase());
}
判断是否是android移动设备
export const isAndroidMobileDevice = () => {
return /android/i.test(navigator.userAgent.toLowerCase());
}
判断死windows还是Mac系统
export const osType = () => {
const agent = navigator.userAgent.toLowerCase();
const isMac = /macintosh|mac os x/i.test(navigator.userAgent);
const isWindows = agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0 || agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0;
if (isWindows) {
return "windows";
}
if(isMac){
return "mac";
}
}
判断是都是微信/QQ内置浏览器
export const broswer = () => {
const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return "weixin";
} else if (ua.match(/QQ/i) == "qq") {
return "QQ";
}
return false;
}
浏览器型号和版本
export const broswer = () => {
const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return "weixin";
} else if (ua.match(/QQ/i) == "qq") {
return "QQ";
}
return false;
}
javascript根据相同id合并形成child子数组(支持低版本浏览器)
上面是“JavaScript开发小技巧之各种设备判断”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1537.html
workflows工作流
一只躲在一堆秋叶里的小刺猬
一只巨大的古代乌龟后面建有一座城市的超现实场景
广阔的沙漠中矗立着一个生锈的巨大头盔
一个闪闪发光的金属球ComfyUI工作流
一棵树从鸟笼里长出来的梦幻般场景
彩色雄鹰玉雕ComfyUI工作流
沙漠里一只红黑相间的蝎子
一只蓬松柔软的圆形半鳄梨玩偶
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

自动打字效果(惊喜在后面)
3D彩色卡片
css3动画loading效果
2023年程序猿如何给自己开启一场烟花盛会
数字滚动效果(兼容IE6/IE8)
css3结合svg做一个动态广告
3d空间行走效果
黑客入侵效果代码










