Home > How to: Hide button on mobile
Categories: Customization | Tips & Tricks
(Last Updated On: July 30, 2021)
About This Article
This article explains how to hide the button on a mobile.
If you are wanting to hide the mobile button, you will need to edit the code snippet you place on your website. Below are 2 options for doing this.
Use this snippet to hide the button on mobile AND disable proactive chat
<!-- begin SnapEngage code -->;
<script type="text/javascript">
(function() {
var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
se.src = '//storage.googleapis.com/code.snapengage.com/js/XXXXXXXXXXXXXXXXXXXXXXXXXXX.js';
var done = false;
se.onload = se.onreadystatechange = function() {
if (!done&&(!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
done = true;
/* Place your SnapEngage JS API code below */
if (navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|Android|IEMobile)/)) {
SnapEngage.hideButton();
SnapEngage.allowProactiveChat(false);
}
}
};
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(se, s);
})();
</script>
<!-- end SnapEngage code —>
Use this snippet to hide the button on mobile AND allow proactive chat
<!-- begin SnapEngage code -->
<script type="text/javascript">
(function() {
var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
se.src = '//storage.googleapis.com/code.snapengage.com/js/XXXXXXXXXXXXXXXXXXXXXXXXXXX.js';
var done = false;
se.onload = se.onreadystatechange = function() {
if (!done&&(!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
done = true;
/* Place your SnapEngage JS API code below */
if (navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|Android|IEMobile)/)) {
SnapEngage.hideButton();
}
}
};
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(se, s);
})();
</script>
<!-- end SnapEngage code -->
Published June 23, 2017