Skip to main content

Code Examples

Changing banner language programmatically

If you want to change the banner language programmatically, i.e. via a JS function, you can do so by calling illow.setLanguage() once the script has already been loaded. Here is an example:

Changing language by calling a function
window.addEventListener(
'illow:widget_ready',
(event) => {
if (event.detail.uiSettings.language !== 'de') {
illow.setLanguage('de'); // The corresponding iso language code must be included within the function. In this example case 'German'
}
}
);

You can also add it to a button:

Change language when clicking on button
<button onclick="illow.setLanguage('de')">German</button>

Opening the banner programmatically

If you want to open the banner programmatically, i.e. through a JS function, you can do it by calling illow.showWidget() once the script has already loaded. Here is an example:

Open banner by calling a function
window.addEventListener(
'illow:widget_ready',
() => illow.showWidget(),
);

You can also add it to a button:

Open banner when clicking on button
<button onclick="illow.showWidget()">Open Banner</button>