const detectDeviceType = () =>
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent,
)
? 'Mobile'
: 'Desktop';
detectDeviceType()
if(detectDeviceType() === 'Mobile'){
// alert('移动');
document.write('<link href="http://10.106.156.16:8080/css/mobile.css" rel="stylesheet" type="text/css" />');
}else if(detectDeviceType() === 'Desktop'){
// alert('pc');
document.write('<link href="http://10.106.156.16:8080/css/pc.css" rel="stylesheet" type="text/css" />');
}else{
document.write('<link href="http://10.106.156.16:8080/css/else.css" rel="stylesheet" type="text/css" />');
}
PC版微信内置浏览器打开会有问题,还没找到原因~~