Overview
You can programmatically control when the Molin AI widget is shown or hidden on your pages. This is useful for:- hiding the widget on specific pages (e.g. checkout, terms of service)
- showing the widget only after certain conditions are met
- managing widget visibility inside iframes
Default behavior
By default, the widget:- is visible on all pages where it’s installed
- is hidden when loaded inside an iframe
- remembers its open/closed state between page navigations (on desktop only)
Customizing visibility
Option 1. Using settings JSON (recommended)
Simply include your settings in a<script> tag, placed anywhere inside the <head></head> section of your website:
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.
Option 2. Programmatically using JavaScript (advanced)
The widget exposes these methods:window.Molin is only available after the widget script has loaded. See Widget script.molin:ready event:
window.Molin is defined:
Examples
Hide on specific pages
Either implement some logic on your backend that controls the value assigned to thehidden property inside window.molinSettings: