Monday, January 11, 2010

Embedding Chat Client for Queue Manager into any page

Use the following IFrame HTML snippet that is used to embed the chat link on any page:

<iframe src ="" style="background-color:Transparent" allowtransparency="true" width="100%" height="40" frameborder="0" scrolling="NO"></iframe>

IFrame points to the api.html file hosting on IQM server.

URL can contain any number of parameters. For example for passing the Queue display name the URL will look like:

api.html page source is as follows:

<link rel="STYLESHEET" href="http://fqdn/TestSTLink/stlinks.css" type="text/css">
<script type="text/javascript" src="http://fqdn/TestSTLink/stlinks.js">
<script type="text/javascript">
var InterviewStartNode="mynode";

<script type="text/javascript">
function getParameter(name, url) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(url);

if (results == null)
return "";
else {
return results[1];

function myunescape(str) {
str = "" + str;
while (true) {
var i = str.indexOf('+');
if (i <>
str = str.substring(0, i) + '%20' +
str.substring(i + 1, str.length);
return unescape(str);

<script type="text/javascript">
writeSTLinksApplet("Web Visitor","",false);

<body style="background-color:transparent">
<script type="text/javascript">
var url=window.location.href;
var userName=getParameter('userName',url);
userName = myunescape(userName);
writeSametimeLink(userName," Live Chat","","",false," text:yes;icon:yes");


In the page getParameter() allows you to get value of any parameter that is passed on to the page. After the value is received you might want to use myunescape() to get rid of any escape character sequences.

No comments: