This code is placed inside the code of the PC template.
<script type= "Text/javascript" >
//platforms, devices and operating systems
var system ={Win:false, Mac:false
, XLL
: False
};
Detection Platform
var p = navigator.platform;
System.win = P.indexof ("win") = = 0;
System.mac = P.indexof ("mac") = = 0;
system.x11 = (P = = "X11") | | (P.indexof ("Linux") = = 0);
if (system.win| | system.mac| | SYSTEM.XLL) {
}else{
window.location.href= "Mobile url";
}
</script>
This code is in the mobile website template
<script type= "Text/javascript" >
//platforms, devices and operating systems
var system ={
Win:false,
mac:false,
Xll:false
};
Detection Platform
var p = navigator.platform;
System.win = P.indexof ("win") = = 0;
System.mac = P.indexof ("mac") = = 0;
system.x11 = (P = = "X11") | | (P.indexof ("Linux") = = 0);
if (system.win| | system.mac| | SYSTEM.XLL) {
window.location.href= "PC URL";
} else{
}
</script>
Ps:js to judge the mobile end and PC-side jump code
var browser_class = navigator.useragent;
var browser_class_name1 = Browser_class.match ("Mobile");
var browser_class_name2 = Browser_class.match ("mobile");
var location_url = window.location.href;
if (browser_class_name1!= null | | | browser_class_name2!= NULL) {
if (Location_url.match ("wap") = = null) {
Window.location.href= "http://wap.xxxx.com";
}
else
{
if (Location_url.match ("3g")!= Null | | | location_url.match ("WAP")!= null) {
Window.location.href= "http://wap.xxxx.com";
}
The above content is a small series to introduce the JavaScript code based on the realization of the PC and mobile phone jump between the whole narrative, I hope you like.