我使用backchannel部署了用c#编写的机器人。它适用于所有浏览器,包括chrome,edge和mozilla firefox,除了Internet Explorer。它只是没有打开。有解决方案吗?
这是我运行的backchannel html代码。
<html>
<head>
<meta charset="UTF-8" />
<title>Bot Chat</title>
<link href="botchat.css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
.wc-chatview-panel {
width: 420px;
height: 500px;
position: relative;
}
.h2{
font-family: Segoe UI;
}
.bottomcorner{
position:absolute;
bottom:5px;
right:0
}
</style>
</head>
<body onload="postLoadMessage()">
<div id="BotChatGoesHere" class="bottomcorner"> <!-- "wc-narrow"></div>-->
<script src="botchat.js"></script>
<script>
var params = BotChat.queryParams(location.search);
var user = { id: userid };
var bot = {
id: bot,
};
window['botchatDebug'] = params['debug'] && params['debug'] === "true";
var botConnection = new BotChat.DirectLine({
secret: secretkey,
token: params['t'],
domain: params['domain'],
webSocket: params['webSocket'] && params['webSocket'] === "true"
});
BotChat.App({
botConnection: botConnection,
user: user,
bot: bot
}, document.getElementById("BotChatGoesHere"));
botConnection.activity$
.filter(activity => activity.type === "event" && activity.name === "changeBackground")
.subscribe(activity => changeBackgroundColor(activity.value))
const changeBackgroundColor = (newColor) => {
document.body.style.backgroundColor = newColor;
}
const postLoadMessage = () => {
botConnection
.postActivity({type: "event", value: "" , from: {id: "me" }, name: "PageLoaded"})
.subscribe(id => console.log("success"));
}
</script>
</body>
</html>
答案 0 :(得分:1)
只需改变:
.subscribe(id => console.log("success"));
使用:
.subscribe(function (id) { console.log("success"); });
在IE中一切都会好的。
实际上,更改所有箭头功能(=&gt;):
foo => ...
带
function(foo) { ... }
因为这些函数是IEAS中不支持的ECMAScript 6的一部分。 有关详细信息,请参阅:https://kangax.github.io/compat-table/es6。