多企業(yè)網(wǎng)站都需要作一個手機(jī)版,所有網(wǎng)站手機(jī)和電腦都可以打開,只是現(xiàn)在的智能手機(jī)不能很好的兼容電腦版的網(wǎng)頁。手機(jī)版的網(wǎng)站需要簡單,以文字為主,才能很好的兼容。可以在網(wǎng)站的首頁設(shè)置一個程序來判斷用戶是手機(jī)端還是電腦。如果是手機(jī)端,直接中轉(zhuǎn)到手機(jī)端 。如果是電腦端 直接中轉(zhuǎn)到電腦端。
在網(wǎng)站的首頁插入入下代碼。
<script type="text/javascript">
function browserRedirect() {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) ){
window.location.href=B頁面;
}
}
browserRedirect();
</script>
<script type="text/javascript">uaredirect("<A href='http://www.aushadhiyoga.com/wap/","http://www.aushadhiyoga.com/index.html");http://www.aushadhiyoga.com/wap/","http://www.aushadhiyoga.com/index.html");</script>