<script type="text/javascript">
var ua = navigator.userAgent;
var isIphone = !ipad && ua.match(/(iPhonesOS)s([d_]+)/),
isAndroid = ua.match(/(Android)s+([d.]+)/),
isMobile = isIphone || isAndroid;
if(isMobile) {
location.herf = 'www.mobile.html';
}else{
location.herf = 'www.pc.html';
}
//或者单独判断iphone或android
if
(isIphone){
//code
else
if
(isAndroid){
//code
}
else
{
//code
}
</script>