很多企业网站都需要作一个手机版,所有网站手机和电脑都可以打开,只是现在的智能手机不能很好的兼容电脑版的网页。手机版的网站需要简单,以文字为主,才能很好的兼容。可以在网站的首页设置一个程序来判断用户是手机端还是电脑。如果是手机端,直接中转到手机端 。如果是PC端 直接中转到PC端。
在网站的首页插入入下代码。
<scripttype='text/javascript'>
functionbrowserRedirect(){
varsUserAgent=navigator.userAgent.toLowerCase();
varbIsIpad=sUserAgent.match(/ipad/i)=='ipad';
varbIsIphoneOs=sUserAgent.match(/iphoneos/i)=='iphoneos';
varbIsMidp=sUserAgent.match(/midp/i)=='midp';
varbIsUc7=sUserAgent.match(/rv:1.2.3.4/i)=='rv:1.2.3.4';
varbIsUc=sUserAgent.match(/ucweb/i)=='ucweb';
varbIsAndroid=sUserAgent.match(/android/i)=='android';
varbIsCE=sUserAgent.match(/windowsce/i)=='windowsce';
varbIsWM=sUserAgent.match(/windowsmobile/i)=='windowsmobile';
if(!(bIsIpad||bIsIphoneOs||bIsMidp||bIsUc7||bIsUc||bIsAndroid||bIsCE||bIsWM)){
window.location.href=B页面;
}
}
browserRedirect();
</script>
<scripttype='text/javascript'>uaredirect('<Ahref='http://www.itwuhan.com/wap/','http://www.itwuhan.com/index.html');http://www.itwuhan.com/wap/','http://www.itwuhan.com/index.html');</script>
<metahttp-equiv='Content-Type'content='text/html;charset=gb2312'/>

