当前位置:网站首页>根据设备信息进行页面跳转至移动端页面或者PC端页面
根据设备信息进行页面跳转至移动端页面或者PC端页面
2022-07-07 08:10:00 【weixin_42178670】
代码如下:
function browserRedict(pcurl, moburl) {
let userAgentInfo = navigator.userAgent.toLowerCase();
let device = /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/;
if(device.test(userAgentInfo)){
window.location.href = moburl;
} else {
window.location.href = pcurl;
}
};
browserRedict("pc.example.com", "mob.example.com");
边栏推荐
猜你喜欢
ISP、IAP、ICP、JTAG、SWD的编程特点
Weekly recommended short videos: what are the functions of L2 that we often use in daily life?
中国首款电音音频类“山野电音”数藏发售来了!
PDF文档签名指南
Some thoughts on the testing work in the process of R & D
Appx code signing Guide
每周推荐短视频:L2级有哪些我们日常中经常会用到的功能?
Remote meter reading, switching on and off operation command
The Himalaya web version will pop up after each pause. It is recommended to download the client solution
request对象对请求体,请求头参数的解析
随机推荐
能源路由器入门必读:面向能源互联网的架构和功能
Programming features of ISP, IAP, ICP, JTAG and SWD
[learning notes - Li Hongyi] Gan (generation of confrontation network) full series (I)
Apprentissage avancé des fonctions en es6
ORM model -- creation and query of data records
Postman interface test IV
Easyexcel read write simple to use
ISP、IAP、ICP、JTAG、SWD的编程特点
Deadlock caused by non clustered index in SQL Server
This article explains the complex relationship between MCU, arm, muc, DSP, FPGA and embedded system
电表远程抄表拉合闸操作命令指令
Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
【HigherHRNet】 HigherHRNet 详解之 HigherHRNet的热图回归代码
Advanced function learning in ES6
ES6中的函数进阶学习
Methods of adding centerlines and centerlines in SolidWorks drawings
Interface test
The physical meaning of imaginary number J
Fiddler break point
嵌入式工程师如何提高工作效率