Chat control via JavaScript - methods for opening, hiding, and creating chat from JS
 

Chat control via JavaScript.

Proper modification of the code allows controlling the chat via JavaScript. Thus, you can for example prevent chat generation when the page is loading, which is very useful, especially for websites where content is loaded dynamically.

How to do this?

First, we need to add to our code:

not_auto_create: true

After this modification, the code will look like this:

modificated script

Then, it is time to properly control the chat via JavaScript by calling appropriate global functions, depending on the effect we want to achieve:

- to generate chat, you need to call a global function:

main();

- to destroy the chat, you need to call a global function:

destroy();

- to show the chat automatically, you need to call a global function:

showChat();

- to hide the chat you need to call a global function:

hideChat().


Your opinion:

Signature:

E-mail address
(will not be shown)

Your rating:

Your comment will be added after moderation