Javascript通过navigator.userAgent来判断访问设备类型:

<script type="text/javascript">
if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){
  alert('移动端')
}
</script>