如何在不使用 <iframe> 标签的情况下在 iframe 中加载聊天应用程序?
How to load the chat application in an iframe without using the <iframe> tag?
我正在尝试使用微软的 Bot Framework webchat 制作一个多租户 Chatbot 应用程序,所以我希望我的客户包含这种我认为是此类应用程序标准的代码:
<script src="link to the cdn" ></script>
<script>
BotfuelWebChat.init({ appToken: '444107',
size: { width: 500, height: 600 },
startOpen: false,
startFullScreen: false,
theme: { colors: { background: '#faf3db', main: '#244891',
primary: '#0084f4' }, layout: { compact: false, rounded: false,
shadowed: false, noHeader: false, noBorder: false,
noHelpMessage: false } } });
</script>
现在我的问题是应该在上面包含的 CDN 中编写什么 javascript 或 jquery 代码,以便我的应用程序能够加载到客户端的聊天框中。
我正在使用 Node.js 作为应用程序的后端。
仅供参考,更详细的需求,我觉得还是自己实现吧。
var BotfuelWebChat = {
init:(options)=>{
const params = BotChat.queryParams(location.search);
var div = document.createElement('div');
div.id='bot';
div.style.width =options.size.width+"px";
div.style.height =options.size.height+"px";
div.style.position ="relative";
document.body.appendChild(div);
BotChat.App({
bot: {id: 'botid'},
locale: params['locale'],
resize: 'detect',
user: {id:'userid'},
directLine: {
secret: options.appSecret,
token: options.appToken
}
}, div);
}
}
并且在您的 html 脚本中:
<script>
BotfuelWebChat.init({
appToken:'directline secret',
size: { width: 500, height: 600 }
})
</script>
我正在尝试使用微软的 Bot Framework webchat 制作一个多租户 Chatbot 应用程序,所以我希望我的客户包含这种我认为是此类应用程序标准的代码:
<script src="link to the cdn" ></script>
<script>
BotfuelWebChat.init({ appToken: '444107',
size: { width: 500, height: 600 },
startOpen: false,
startFullScreen: false,
theme: { colors: { background: '#faf3db', main: '#244891',
primary: '#0084f4' }, layout: { compact: false, rounded: false,
shadowed: false, noHeader: false, noBorder: false,
noHelpMessage: false } } });
</script>
现在我的问题是应该在上面包含的 CDN 中编写什么 javascript 或 jquery 代码,以便我的应用程序能够加载到客户端的聊天框中。
我正在使用 Node.js 作为应用程序的后端。
仅供参考,更详细的需求,我觉得还是自己实现吧。
var BotfuelWebChat = {
init:(options)=>{
const params = BotChat.queryParams(location.search);
var div = document.createElement('div');
div.id='bot';
div.style.width =options.size.width+"px";
div.style.height =options.size.height+"px";
div.style.position ="relative";
document.body.appendChild(div);
BotChat.App({
bot: {id: 'botid'},
locale: params['locale'],
resize: 'detect',
user: {id:'userid'},
directLine: {
secret: options.appSecret,
token: options.appToken
}
}, div);
}
}
并且在您的 html 脚本中:
<script>
BotfuelWebChat.init({
appToken:'directline secret',
size: { width: 500, height: 600 }
})
</script>