Forcing your chat to load

December 11, 2024

Recently, I added a feature that requires chats to be initialized before they can finish loading. "Initializing a chat" is when you send CSS to the iframe, usually through the Chattable JS library. The reason I made this decision was to prevent chat's from loading until they have received CSS. This ensures that the chat doesn't load before your site does, which would result in the chat briefly displaying the default/unstyled theme.

If you want to use an unstyled chat, you can force the chat to load unstyled by sending an empty CSS string to the iframe. Copy paste the snippet below anywhere below your iframe in your HTML document and it will display your chat again, completely unstyled.

<script> document.getElementById("chattable").contentWindow.postMessage("", "*"); </script>