@Martin Puge Wondering if you’ve already followed the instructions for integrating the Intercom Messenger into a Single Page Application? If not, I’d recommend starting there and it may address the issue you are having already -- if not let us know!
Hope this helps
Hacky, but if you must:
const intercomWidget = document.querySelector<HTMLElement>(
'div.intercom-lightweight-app-launcher, iframe.intercom-launcher-frame',
)
if (intercomWidget) console.log('Intercom widget is loaded!')
else console.log('Intercom widget is NOT loaded.')
This checks the presence of the button in the bottom right corner.
Note: `<HTMLElement>` is a TypeScript annotation. Remove it if using plain JavaScript.