The ICAEW Blogs & Forums will no longer be updated with new posts. Your community announcements and articles will now be hosted on icaew.com under their respective community areas. This site and its contents will be closed and made available in an archive at the end of October.
I'm trying to implement a Microsoft botframework chatbot on our site but don't want to burden the users who won't engage with the bot with the 470Kb library unless they choose to start a chat.
When the framework is included in the page source, the bot initialises and launches but when I remove this from the page source and instead write it to the page when the user clicks a button to start the bot, the script is written to the page and can be seen in DevTools sources but does not initialise cleanmaster.
I've tried several methods of delaying the initialisation until after the script has downloaded, but none of these have worked whether the script is hosted locally or from the MS CDN https://cdn.botframework.com/botframework-webchat/latest/botchat.js.
Even manually checking for the BotChat object in console returns BotChat is not defined.
Is it possible to lazy load the framework after page load?