Hiding the Chat widget on mobile devices
Note: This guide applies only to the Chat widget from Chat-only accounts, not from Chat+Support accounts. See About Chat account types in Zendesk help.
You can hide the Chat widget from visitors on mobile devices.
-
Paste the following script tag in the head of the page or pages that have the widget.
<script type="text/javascript">
var ua = navigator.userAgent.toLowerCase(), platform = navigator.platform.toLowerCase();
platformName = ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || platform.match(/mac|win|linux/) || ['other'])[0],
isMobile = /ios|android|webos/.test(platformName);
if (!isMobile) {
//place your chat embed code here without the <script> tags
}
</script>
The first part of the script determines whether or not the web client is a mobile device. The second part displays the widget only if it's not a mobile device.
-
Move the widget embed code to the location in the script above.
In this case, remove the script tags that normally enclose the embed code.