Event handling

The visitor's chat window in Netrox SC triggers events that can be handled in Javascript code on the site. Event handling allows for interfering with the chat window behavior and correcting standard actions or modifying them altogether.

There are two ways to connect your own handler to a Netrox SC widget event on your site. If you are using the jQuery library, you can bind handlers using this library's default methods. Otherwise you can bind handler functions via the nsc_API object.

Attention! You cannot combine two event handling methods described here. You have to select one of the two and stick to it within the document (site page). If nsc_API has been defined, jQuery events will not be triggered.

Handling events using the jQuery library

If a jQuery library is being used on your site, you can use the .on() method to connect the event listeners to the document object. Aside from the mostly regular entry, the advantage of this method is that you can bind several handlers for one event and use namespaces for flexible connection and disconnection of handlers. All events are named in the lower case with the prefix netrox instead of on. The first argument, passed to handler is the event object, while the following arguments are the Netrox SC event data in the order given in this manual.


function newMessageHandler(event, messages) {
    alert("new message");
$(document).on("netroxnewmessage", newMessageHandler);

Handling events using the nsc_API object

Handlers can also be created by defining the nsc_API JavaScript object on the page. Each method of this object is a handler for a certain event. It is not obligatory to define methods for all events. Do only for those ones you are planning to handle.


  1. Simultaneous initialization of the API object with several event handlers:
    nsc_API = {
        onNewMessage: function() {
            // Your actions upon arrival of new message 
        onOffline: function() {
            // Your actions upon going offline
         *    More event handlers
        onOnline: function() {
            // Your actions upon going online
  2. Adding methods to an already-initialized API object
    nsc_API = { /* ... */ };
    nsc_API.onNewMessage = function() {
        // Your actions upon arrival of new message 
    nsc_API.onOffline = function() {
        // Your actions upon going offline
         *    More event handlers

Netrox SC events available for processing:

Имя событияОписание

Minimization of the chat widget for the Pop-Up and Slider types. Activates upon the finishing of the closing process animation.


Following the opening of chat widget for Pop-Up and Slider types. Activates upon the finishing of the opening process animation.


Activates upon completion of the filter's automatic actions.


The event activates before the chat widget initializes.


It activates before rendering a new chat message, offering the ability to modify it.


Triggers prior to the starting of the automatic action filter.


The event is trigged after the visitor has cleared the chat using the corresponding chat widget tool.


The event of minimization of the chat widget for the Pop-Up and Slider types.


Is triggered when the visitor sends the chat to their own email address.


The event of the visitor's sending of the chat to their own email address.


Is triggered after the chat widget initializes in one of the statuses (Online/Offline).


The message sending event in the online chat widget window. This has to return the "true" or "false" value (and ether send or not send a message accordingly).


You can perform some actions upon the event of arrival of new chat message.


Triggers when the chat widget goes offline. This refers to when the last operator leaves the system.


The event of sending a message in the offline form.


Activates when the chat widget goes online. In other words, it activates when there are operators available to chat.


The event of opening/advancement of the "Slider" and "Pop-up" chat widgets.


Activates when the visitor turns the chat widget sounds on/off.


The event of modification of visitor data input fields.


The event enables you to additionally handle the visitor's changing of the chat widget dimensions.

All rights reserved. Copyright © 2021 Netrox SC
Host CMS