We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5a8febb commit a4e6cc2Copy full SHA for a4e6cc2
1 file changed
bot.js
@@ -3,6 +3,13 @@
3
4
const MESSAGE_DELAY = 1000;
5
const observer = new MutationObserver(onNewMessage);
6
+let HTMLPolicy;
7
+
8
+if (window.trustedTypes) {
9
+ HTMLPolicy = trustedTypes.createPolicy("HTMLPolicy", {
10
+ createHTML: (string) => string,
11
+ });
12
+}
13
14
var currentSender = null;
15
@@ -26,7 +33,12 @@ function simulateClick(element) {
26
33
}
27
34
28
35
function sendMessage(messagebody) {
29
- window.bot_textbox.innerHTML = messagebody;
36
+ if (window.trustedTypes) {
37
+ window.bot_textbox.innerHTML = HTMLPolicy.createHTML(messagebody);
38
+ } else {
39
+ window.bot_textbox.innerHTML = messagebody;
40
+ }
41
30
42
setTimeout(function() {
31
43
window.bot_textbox.focus();
32
44
simulateClick(window.bot_sendbutton);
0 commit comments