Learn how to control widget visibility
You can programmatically control when the Molin AI widget is shown or hidden on your pages. This is useful for:
By default, the widget:
Simply include your settings in a <script>
tag, placed anywhere inside the <head></head>
section of your website:
If you set hidden: true
, the widget launcher will be hidden when it loads, in all cases, on both mobile and desktop.
If you set hidden: false
, the widget launcher will be visible when it loads, in all cases, on both mobile and desktop, even if the page was loaded inside an iframe.
If you do not set hidden
to any value, then the default behavior explained above will apply.
The widget exposes these methods:
window.Molin
is only available after the widget script has fully loaded. We use various algorithms to delay the loading of the script to minimize impact on your website’s performance.
The widget’s visibility methods are only available after the widget script has loaded. Always check that window.Molin
exists before calling methods:
Either implement some logic on your backend that controls the value assigned to the hidden
property inside window.molinSettings
:
or use JavaScript to hide the widget on specific pages:
You can add a “Chat with us” button to your page that opens the chat window when clicked: