当前位置:网站首页>根据设备信息进行页面跳转至移动端页面或者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");
边栏推荐
- Google Colab装载Google Drive(Google Colab中使用Google Drive)
- Advanced function learning in ES6
- .NET配置系统
- Win10 installation vs2015
- Google colab loads Google drive (Google drive is used in Google colab)
- Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
- ORM -- database addition, deletion, modification and query operation logic
- ES6中的函数进阶学习
- XML配置文件解析与建模
- IPv4 socket address structure
猜你喜欢

【acwing】786. Number k

Enterprise practice | construction of banking operation and maintenance index system under complex business relations

The story of Plato and his three disciples: how to find happiness? How to find the ideal partner?

电表远程抄表拉合闸操作命令指令

The request object parses the request body and request header parameters

Appx code signing Guide

LeetCode 练习——113. 路径总和 II

Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software

Pdf document signature Guide

Postman interface test I
随机推荐
ORM -- logical relation and & or; Sort operation, update record operation, delete record operation
ES6中的函數進階學習
ES6中的函数进阶学习
CONDA creates virtual environment offline
Postman interface test VII
嵌入式背景知识-芯片
每周推荐短视频:L2级有哪些我们日常中经常会用到的功能?
Fiddler break point
Apprentissage avancé des fonctions en es6
Enterprise practice | construction of banking operation and maintenance index system under complex business relations
Finally, there is no need to change a line of code! Shardingsphere native driver comes out
单片机(MCU)最强科普(万字总结,值得收藏)
Agile course training
MCU is the most popular science (ten thousand words summary, worth collecting)
Fiddler simulates the interface test
request对象对请求体,请求头参数的解析
Download Text, pictures and ab packages used by unitywebrequest Foundation
Some test points about coupon test
[second on] [jeecgboot] modify paging parameters
能源路由器入门必读:面向能源互联网的架构和功能