Each time a user clicks the 'Start Chat' Button, the webchat.renderFrame({}) writes a new chat frame in the containerEl.
This has the effect of launching multiple frames when the user clicks Start Chat multiple times.
Is there configuration option in the renderFrame method to replace an existing frame?
LAUNCH CODE
function startEmbeddedChat() {
createChatConfig();
ININ.webchat.create(chatConfig, function(err, webchat) {
if (err) {
throw err;
}
// Render to frame
webchat.renderFrame({
containerEl: 'chatContainer'
});
});
}
$('#webchat_submit').on("click", function (e) {
e.preventDefault();
startEmbeddedChat()
});
HTML OUTOUT
<div id="chatContainer" style="height:500px">
<iframe class="webchat-frame" src="https://apps.mypurecloud.com.au/webchat/frame/#? style="width: 100%; height: 100%;">
<iframe class="webchat-frame" src="https://apps.mypurecloud.com.au/webchat/frame/#? style="width: 100%; height: 100%;">
</div>