<script type="text/javascript">//判断访问终端var browser={versions:function(){var u = navigator.userAgent, app = navigator.appVersion;return {trident: u.indexOf('Trident') > -1, //IE内核presto: u.indexOf('Presto') > -1, //opera内核webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器iPhone: u.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器iPad: u.indexOf('iPad') > -1, //是否iPadwebApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (-01-22新增)qq: u.match(/\sQQ/i) == " qq" //是否QQ};}(),language:(navigator.browserLanguage || navigator.language).toLowerCase()}// document.write("用户代理: " + navigator.userAgent);//用户代理// document.write("版本信息: " + navigator.appVersion);//浏览器版本//判断是否IE内核if(browser.versions.trident){alert("is IE"); }if(browser.versions.weixin){alert('weixin')}if(browser.versions.gecko){alert('huohu')}//判断是否webKit内核if(browser.versions.webKit){alert("is webKit"); }判断是否移动端if(browser.versions.mobile||browser.versions.android||browser.versions.ios){alert("移动端"); }if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {alert(navigator.userAgent); //苹果端} else if (/(Android)/i.test(navigator.userAgent)) {alert(navigator.userAgent); //安卓端} else {//pc端};</script>````
1500字范文,内容丰富有趣,写作好帮手!