判断浏览器是手机还是pc
<script type="text/javascript">
var type = navigator.userAgent.match(/.*Mobile.*/)?"mobile":"pc";
if(type=="pc"){
$.getScript("http://vc3.cn/Public/home/js/jquery.flexslider.js",function(){
});
}
</script>
jquery的写法
<script type="text/javascript">
var strFullPath=window.location.href;
var strPath=window.location.pathname;
var pos=strFullPath.indexOf(strPath);
var prePath=strFullPath.substring(0,pos);
if($(window).width()>789){
$.getScript(prePath+"/Public/home/js/jquery.flexslider.js",function(){});
}
</script>
扫描关注官方微信