判断是移动还是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工作流
一颗闪闪发光的水晶漂浮在森林里
小孩手握锤子顽皮搞笑卡通3d形象
一尊白玉佛像ComfyUI工作流
一群可爱的小老鼠ComfyUI工作流
半透明的玻璃苹果ComfyUI工作流
一群蚂蚁在路上忙碌着ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

js实现下雪特效
jquery做一个漂亮挂墙动态时钟
canvas空间文本射线
3d空间行走效果
利用CSS3做一个星级评分样式
自动打字效果(惊喜在后面)
css3实现星球旋转
3D彩色卡片







