方法一:简单明了
function cellphoneTips()
{
if(navigator.platform.indexOf('Win32')!=-1)
{
alert("pc");
}
else
{
alert("cellphone");
}
}
方法一:终端明确
function isTelphone(){
if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){
if(window.location.href.indexOf("?mobile")<0){
try{
if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
return true;
}else if(/iPad/i.test(navigator.userAgent)){
}else{
}
}catch(e){}
}
}
return false;
}