From a4c1a04900c5b0e8adbeeac02176686692a3921e Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Mon, 7 Aug 2023 17:54:35 +0800 Subject: [PATCH] iframe --- client/public/js/iframe.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/client/public/js/iframe.js b/client/public/js/iframe.js index 5b0e3421e..9da207a8c 100644 --- a/client/public/js/iframe.js +++ b/client/public/js/iframe.js @@ -27,8 +27,6 @@ async function embedChatbot() { 'transition: all 0.2s ease-in-out 0s; left: unset; transform: scale(1); :hover {transform: scale(1.1);} display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; z-index: 9999;'; ChatBtnDiv.innerHTML = MessageIcon; - ChatBtn.appendChild(ChatBtnDiv); - const iframe = document.createElement('iframe'); iframe.allow = 'fullscreen;microphone'; iframe.title = 'FastGpt Chat Window'; @@ -40,10 +38,6 @@ async function embedChatbot() { document.body.appendChild(iframe); - iframe.onload = () => { - document.body.appendChild(ChatBtn); - }; - ChatBtn.addEventListener('click', function () { const chatWindow = document.getElementById(chatWindowId); @@ -57,5 +51,8 @@ async function embedChatbot() { ChatBtnDiv.innerHTML = MessageIcon; } }); + + ChatBtn.appendChild(ChatBtnDiv); + document.body.appendChild(ChatBtn); } document.body.onload = embedChatbot;