Open sprklinginfo opened 1 month ago
Hi @sprklinginfo,
You can use the JavaScript example to import Deep Chat using <script>
. You can then embed it into your markup via the following JavaScript:
const chatContainerEl = document.getElementById('chat-container');
// the following code is in a timeout to make sure the script has loaded
setTimeout(() => {
const chatEl = document.createElement('deep-chat');
chatEl.demo = true; // example to set properties
chatContainerEl.appendChild(chatEl);
}, 100); // the number may need to be increased depending on how long it takes to download the script
TIP: You can speed up the script download by storing it alongside with your project by downloading the following file, storing it along with your project as a static asset and pointing to it in the script
tag's src
attribute.
Let me know if this helps.
thanks. I will try it.
My company's website is built with commercial software which is managed by an IT team. As an admin of my department, I can add new pages with a predefined template. only a subset of approved HTML tags are allowed. so
<deep-chat>
tag won't stay. but I can use<script>
tag to add some small js functions to enhance a page a little bit. is there a way I can wrap<deep-chat>
component into a<script>
tag and drop it on an existing page? The goal is to display it as a float button at the lower-right corner of a web page, as described on this issue. Another real live example is a library website, the 'Ask us live' button at the lower-right corner of the page. I am a little confused how it is implemented. any suggestions or ideas are much appreciated.