当前位置:网站首页>js简单代码判断打开页面的设备是电脑PC端或手机H5端或微信端
js简单代码判断打开页面的设备是电脑PC端或手机H5端或微信端
2022-07-29 05:12:00 【coderYYY】
// 先判断是不是微信端打开的
if (/(micromessenger)/i.test(navigator.userAgent)) {
alert("微信");
} else {
alert("普通浏览器");
// 判断h5还是pc
let client =
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
);
if (client) {
alert("h5");
} else {
alert("pc");
}
}
边栏推荐
猜你喜欢
![[event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises](/img/6f/f7c5d605ea9b7b9e7c49ac716492ef.jpg)
[event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises

Day 1
![Niuke network programming problem - [wy22 Fibonacci series] and [replace spaces] detailed explanation](/img/39/1d4fb1774b0f9f7c9bb13221f0d6c2.png)
Niuke network programming problem - [wy22 Fibonacci series] and [replace spaces] detailed explanation

Three handshakes and four waves for the interview summary

关于局部变量

Detailed explanation of GPIO input and output

B - 识别浮点常量问题

三次握手四次挥手针对面试总结

ClickHouse学习(六)语法优化

C language one-dimensional array
随机推荐
组件传参与生命周期
【C语言系列】—三种方法模拟实现strlen库函数的方法
Best practices for elastic computing in the game industry
Occt learning 003 - MFC single document project
Selenium实战案例之爬取js加密数据
Cryengine3 debugging shader method
游戏行业弹性计算最佳实践
Day 3
Do students in the science class really understand the future career planning?
【TypeScript】TypeScript中类型缩小(含类型保护)与类型谓词
Question swiping Madness - leetcode's sword finger offer58 - ii Detailed explanation of left rotation string
One dimensional array exercise
重绘与回流的关系
Storage category
Camunda 1、Camunda工作流-介绍
【C语言系列】— 不创造第三个变量,实现两个数的交换
C language n queen problem
End of document
Introduction to array learning simple question sum of two numbers
Database operation day 6