Visitor Events

Visitor Events are the events included within the visitor side behavior of Cobrowse:


A session that is in the process of starting. Occasionally it can take a moment for the session to start. This event is followed by either "sessionstart" or "error."


Occurs when a session has successfully started.


Occurs when a session has continued after a visitor navigated to a new page.


Occurs after a visitor has navigated to a new page and the initial session state has been received from the session server. Call GLANCE.Cobrowse.Visitor.getSessionState() to retrieve the state information.


Occurs when a session has ended.


Indicates that an error occurred. The object passed to the event handler contains information about the error. Possible error codes:

  • service
  • conndrop

Object Passed to Event Handler

{ msg : \[a description of the error\] }

{ code : \[error code\] msg: \[message\] }


Occurs when updated agent information is available. This event occurs when a page first loads, and again whenever the agent's information changes. The object passed to the event handler contains information about the agents viewing the session.

Object Passed to Event Handler

{ count : \[agent count\] }


Occurs when the visitor clicks on or opens another browser tab or window pointing to the same website. The newly activated window takes session focus and blur occurs in the original window.


Occurs when the visitor clicks on the window, making it the active session window,


Occurs when an agent requests remote control. Call accept() to continue or decline() if the visitor does not wish to allow remote control.

Object Passed to Event Handler

{accept : \[callback fn\],decline: \[callback fn\]}


Occurs when the remote control state changes. When remote control is enabled, the rc event also occurs whenever the visitor navigates to a new page.

Object Passed to Event Handler

{ enabled :\[true | false\] }


Occurs when accessibility features are turned on or off.

Object Passed to Event Handler

{ enabled :\[true | false\] }


Occurs when an agent requests the visitor joins a reverse session. Call accept to continue, or decline if the visitor does not wish to join.

Object Passed to Event Handler

{accept : \[callback fn\], decline: \[callback fn\]}


Occurs when the agent ends a reverse session. The session will automatically end for the visitor. However, if a reverse session confirmation dialog is still pending a visitor response, hide it on reverseended.**


Occurs when a screen share session starts or ends. screenshareView will be "glance_screenshare" or "glance_agentvideo" if using a standard Glance Cobrowse agent viewer such as the Glance 3 client. If using a custom agent viewer, screenshareView may be a custom name. This event occurs as follows:

  • When a screen share session first starts(state="new").
  • After every page load—as long as the session is in progress (state="continued").
  • When a screen share session ends(state="ended").

Handle this message by positioning, sizing and displaying the iframe identified by screenshareView. See Screen Share and Agent Video within a Cobrowse session for more information.

Object Passed to Event Handler

{ screenshareView : \[viewname\], state : \["new"| "continued"| "ended"\], paused : \[true|false\] }

screensharepause and screenshareresume

Occurs when the agent pauses or resumes the screen share session. This event is typically handled by hiding the corresponding screenshare viewer, or by replacing it with a static image.

Object Passed to Event Handler

{ screenshareView : \[viewname\] }


Occurs when screenshare viewer information is available. It occurs after a Screen Share session is first started, and subsequently, when the display side monitor or resolution changes.

For sessions running in video mode, this event also occurs periodically to report statistics such as viewer frame rate The screenshareView property indicates the viewer to which the viewer information applies. All other properties are provided if they have changed since the last viewerinfo event This event is typically handled by adjusting the dimensions of the screen share viewer according to the display resolution.

Object Passed to Event Handler

{ screenshareView: \[viewname\], screen : { width: \[w\], height : \[h\]} scaledview : {width: \[w\], height : \[h\]} glance\_viewer : { stats : { fpslimit: \[n\] viewerfps: \[n\] displayfps: \[n\] } } }


Occurs when the status of the connection to the Glance Cobrowse Service has changed. The UI may display a connectivity warning if the status is"reconnecting," and clear the warning if the status is"ok."

A connection event with statusreconnecting will be followed by either a connection event with the statusokor an error event with codeconndrop.

Object Passed to Event Handler

{ status : \["ok" | "reconnecting"\] } {}


Occurs as parameters are passed onto the page URL signaling that a session should continue on a new domain. This technique for cross domain cobrowse is only required for IE9 and 10.

Object Passed to Event Handler

{ accept : \[callback fn\], decline: \[callback fn\] }

Invoking Visitor API from Another Window

In some cases, it is useful to control the Cobrowse session from a window other than the one the visitor is browsing the instrumented website from. A chat window is a typical example.

To support this functionality, the visitor window listens for glance_invoke messages posted from the chat window. The window message handler will only accept glance_invoke messages if the domain of the origin is in the list of trusted domains as configured in the Cobrowse settings for the account.



To invoke a GLANCE.Cobrowse.Visitor function from a chat window using GLANCE.Cobrowse.InvokeVisitor, add the GlanceCobrowseInvokeVisitor.js to the chat window page.


The following methods are available on Glance.Cobrowse.InvokeVisitor:

Method Description
init(wnd, groupid, origin)
init initializes the GLANCE.Cobrowse.InvokeVisitor object.
wnd is the visitor browser window.
groupid must match the group ID in the Cobrowse script tag in the visitor page.
origin should be the hostname of the visitor's current page, or "*" if it is okay to post the glance_invoke message to any page.
invoke(func, args)
Invoke the function func passing the specified args.


GLANCE`.Cobrowse.InvokeVisitor.init(wnd, 12345, "");
GLANCE.Cobrowse.InvokeVisitor.invoke("startSession", { sessionKey : "9999" });


To invoke a GLANCE.Cobrowse.Visitor function from another window using postMessage, post a message to the visitor window in the form:

glance_invoke : { func : [method of GLANCE.Cobrowse.Visitor], args : [args object], groupid : [goupid]}
The groupid must match the groupid on the visitor side.


wnd.postMessage({ glance_invoke: { func: "showTerms", args: { sessionKey: "12121212" }, groupid: "72937"} }, "*")

By continuing to use the site, you agree to the use of cookies. Learn More