判断是手机用户还是pc用户

<script language="JavaScript" type="text/javascript">  
	{  	
		if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)){
		window.location.href='phone.html';
		}else{
			window.location.href='index.html';
			}
	 	
	}     
</script>

 

posted @ 2014-11-20 18:03  yanzhijun  阅读(170)  评论(0)    收藏  举报