Hi,
Would you pleae check for the existence of a document element with the id "front-chat-iframe
" before calling FrontChat('show')
and let me know if that helps?
--Evan
Thanks for your response. I tried the change but still have the same issue. It looks like if the 'show
' command is called within about 500ms of the 'init
' command, it has no effect even if id is present.
I can create a feature request to make the init
request return a Promise indicative of its asynchronous nature. Until then, you'll need to wait 1 second before calling show
.
It's not something documented, although I should be able to make a case for something like this to be publicly documented. However, we find this to be a good code snippet to prevent 'init
' errors. Please note the async
property in the script; this blocks the call to onload
until the script is finished loading.
<script src="https://chat-assets.frontapp.com/v1/chat.bundle.js" onload="initFrontChat()" async></script>
<script>
function initFrontChat() {
window.FrontChat('init', {chatId: 'YOUR_CHAT_ID', useDefaultLauncher: true});
};
</script>
--Evan