我的网站上有一个聊天小部件,它占据了手机的整个屏幕。
如何在一定宽度的设备(或手机)上禁用聊天设备?
<script type="text/javascript">
var _glc = _glc || [];
_glc.push('all_agddsffsd');
var glcpath = (('https:' == document.location.protocol) ? 'https://my.clickdesk.com/clickdesk-ui/browser/'
: 'http://my.clickdesk.com/clickdesk-ui/browser/');
var glcp = (('https:' == document.location.protocol) ? 'https://'
: 'http://');
var glcspt = document.createElement('script');
glcspt.type = 'text/javascript';
glcspt.async = true;
glcspt.src = glcpath + 'livechat-new.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(glcspt, s);
</script>
我以前使用过这段代码,它工作得很好:
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
if(!isMobile.any()) {
/* Your Code to disable in mobile here */
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)