The best solution is to refrain from inserting the script / code snippet for the Web Widget on the pages where it should not be displayed.
<!-- Start of subzero-dk Zendesk Widget script --> <script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=XXXXXXXX-XXXX-XXXX -XXXX-XXXXXXXXXXXX"> </script> <!-- End of subzero-dk Zendesk Widget script -->
If you do not have the option to selectively control which pages the script is to be inserted on, the following are alternative options. However, be aware that these alternative options can suddenly stop working without warning (if Zendesk changes the iframe title) and that they must be corrected in order for them to work again. Please contact us if this happens. We will then investigate and update this guide with a corrected solution.
If you have access to add Javascript on the website and the button must be completely removed
With Javascript, you can completely remove the button to open the Web Widget after it is loaded by adding the following script to the end of the <body>
document.querySelector('iframe[title="Button to launch messaging window"]').remove();
The script must be loaded after the Web Widget button is visible on the website. If this is not possible, you have to use MutationObserver or set a timeOut.
If it should be possible to show and hide the Web Widget button
With JS
In this case, it is better to just hide the button so that it can also be shown again quickly:
To hide the button run the following script:
document.querySelector('iframe[title="Button to launch messaging window"]').style.display = 'none';
To show the button again, run the following script:
document.querySelector('iframe[title="Button to launch messaging window"]').style.display = 'block';
With CSS
It is also possible to hide the button only with CSS:
iframe[title="Button to launch messaging window"] {
display: none;
}
And to show it again:
iframe[title="Button to launch messaging window"] {
display: block;
}