Title: Live-chat in wordpress (javascript)
Last modified: 4 augustus 2016

---

# Live-chat in wordpress (javascript)

 *  [elifecoach](https://nl.wordpress.org/support/users/elifecoach/)
 * (@elifecoach)
 * [16 jaren geleden](https://nl.wordpress.org/support/topic/live-chat-in-wordpress-javascript/)
 * I have a live-chat and to work i need to put the first code in to de header section/
   head; `
    And the imamage in the body (html): <body>
 * But it does not seem to work?
    Any solutions?
 * I have this code that needs to be in header;
 *     ```
       <span id="ie_ready" style="font-size: 1px; height: 1px; width: 1px;">&nbsp;</span>
       <script language="Javascript" type="text/javascript">
   
       var jlcAlreadySetup = false;
       var hostedModePropertiesAlreadySetup = false;
   
       function getCurrentScheme() {
           var curUri = String(document.location.href);
           var scheme = 'http://';
   
           if(curUri.indexOf('https://') > -1) {
       	scheme = 'https://';
           }
   
           return scheme;
       }
   
       function injectTrackerImg() {
           var bodySection = document.getElementsByTagName('body').item(0);
   
           // These values can be injected dynamically
           var userId = '';
           var fullname = '';
           var username = '';
           var email = '';
   
           var trackImg = document.createElement('img');
           var trackImgUri = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/index.php?option=com_jlivechat&no_html=1&tmpl=component&view=popup&task=track_remote_visitor';
   
           if(userId != '') {
       	trackImgUri += '&user_id='+userId;
           }
   
           if(fullname != '') {
       	trackImgUri += '&full_name='+URLEncode(fullname);
           }
   
           if(username != '') {
       	trackImgUri += '&username='+URLEncode(username);
           }
   
           if(email != '') {
       	trackImgUri += '&email='+URLEncode(email);
           }
   
           if(document.referrer) {
       	trackImgUri += '&referrer='+URLEncode(document.referrer);
           }
   
           trackImgUri += '&last_uri='+URLEncode(document.location.href);
   
           trackImg.src = trackImgUri;
           trackImg.alt = '';
           trackImg.style.width = '1px';
           trackImg.style.height = '1px';
           trackImg.style.border = '0';
   
           bodySection.appendChild(trackImg);
       }
   
       function setupHostedModeProperties() {
           if(hostedModePropertiesAlreadySetup || window.JLiveChatIFramePopup == undefined || window.ProactiveChatChecker == undefined || window.AutoPopupChecker == undefined) {
       	return false;
           }
   
           hostedModePropertiesAlreadySetup = true;
   
           JLiveChatIFramePopup.popupUri = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/index.php?option=com_jlivechat&view=popup&tmpl=component&popup_mode=iframe';
           JLiveChatIFramePopup.websiteRoot = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545';
           JLiveChatIFramePopup.hostedUri = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545';
   
           ProactiveChatChecker.hostedModeUri = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545';
           ProactiveChatChecker.comUri = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/index.php?option=com_jlivechat&view=popup&tmpl=component';
           ProactiveChatChecker.websiteRoot = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545';
           ProactiveChatChecker.keepChecking = true;
   
           AutoPopupChecker.hostedModeUri = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545';
           AutoPopupChecker.comUri = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/index.php?option=com_jlivechat&view=popup&tmpl=component';
           AutoPopupChecker.websiteRoot = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545';
   
           injectTrackerImg();
   
           return true;
       }
   
       function setupJLiveChat() {
           if(jlcAlreadySetup) {
       	return false;
           }
   
           jlcAlreadySetup = true;
   
           var headSection = document.getElementsByTagName('head').item(0);
   
           var css1 = document.createElement('link');
           css1.type = 'text/css';
           css1.rel = 'stylesheet';
           css1.href = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/components/com_jlivechat/assets/css/jlivechat.css';
   
           var script1 = document.createElement('script');
           script1.type = 'text/javascript';
           script1.src = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/media/system/js/mootools.js';
   
           var script2 = document.createElement('script');
           script2.type = 'text/javascript';
           script2.src = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/components/com_jlivechat/js/lazyload-min.js';
   
           var script3 = document.createElement('script');
           script3.type = 'text/javascript';
           script3.src = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/components/com_jlivechat/js/jlivechat.js';
   
           var script4 = document.createElement('script');
           script4.type = 'text/javascript';
           script4.src = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/components/com_jlivechat/js/chat_iframe.js';
   
           var script5 = document.createElement('script');
           script5.type = 'text/javascript';
           script5.src = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/components/com_jlivechat/js/remote.js';
   
           var script6 = document.createElement('script');
           script6.type = 'text/javascript';
           script6.src = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/index.php?option=com_jlivechat&view=popup&task=check_proactive';
   
           var script7 = document.createElement('script');
           script7.type = 'text/javascript';
           script7.src = getCurrentScheme()+'www.ultimatelivechat.com/sites/2292/646545/index.php?option=com_jlivechat&view=popup&task=check_autopopup';
           script7.onload=setupHostedModeProperties;
           script7.onreadystatechange=function(){
       	if (this.readyState == 'loaded' || this.readyState == 'complete') {
       	    setupHostedModeProperties();
       	}
           }
   
           headSection.appendChild(css1);
           headSection.appendChild(script1);
           headSection.appendChild(script2);
           headSection.appendChild(script3);
           headSection.appendChild(script4);
           headSection.appendChild(script5);
           headSection.appendChild(script6);
           headSection.appendChild(script7);
   
           return true;
       }
   
       if (document.addEventListener) {
           document.addEventListener("DOMContentLoaded", function(){ setupJLiveChat() }, false);
       } else if (document.all && !window.opera) {
           document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>')
   
           var contentloadtag = document.getElementById("contentloadtag");
   
           contentloadtag.onreadystatechange=function(){
       	if(this.readyState=="complete" || this.readyState=="loaded") {
       	    setupJLiveChat();
       	}
           }
       }
   
       window.onload=function(){
           setTimeout("setupJLiveChat();", 5)
       }
       </script>
       ```
   
 * and this code to show picture in body;
 *     ```
       <script language="Javascript" type="text/javascript">
   
       var curUri = String(document.location.href);
       var currentTimestamp = Math.round(((new Date()).getTime()-Date.UTC(1970,0,1))/1000);
       var uriScheme = 'http://';
   
       if(curUri.indexOf('https://') > -1) {
           uriScheme = 'https://';
       }
   
       // You can change the following variables if you know what you are doing, otherwise the leave the defaults
       var popupOpenMode = 'popup'; // Could be popup or iframe
       var imgSize = 'large'; // Could be large or small
       var specificOpertors = ''; // Comma seperated list of Operator IDs
       var specificDepartment = ''; // Specific department to send visitor to, if any
       var specificRouteId = ''; // Specific route id to send visitor to, if any
   
       var livechatImgUri = uriScheme+'www.ultimatelivechat.com/sites/2292/646545/index.php?option=com_jlivechat&view=popup&task=display_status_img&no_html=1&do_not_log=true&t='+currentTimestamp;
   
       livechatImgUri += '&size='+imgSize;
   
       if(specificOpertors != '') {
           livechatImgUri += '&operators='+specificOpertors;
       }
   
       if(specificDepartment != '') {
           livechatImgUri += '&department='+specificDepartment;
       }
   
       if(specificRouteId != '') {
           livechatImgUri += '&routeid='+specificRouteId;
       }
   
       var livechatImg = '<a href="javascript:void(0);" onclick="requestLiveChat(\'http://www.ultimatelivechat.com/sites/2292/646545/index.php?option=com_jlivechat&view=popup&tmpl=component&popup_mode='+popupOpenMode+'\', \''+popupOpenMode+'\');"><img src="'+livechatImgUri+'" border="0" alt="" /></a>';
   
       document.writeln(livechatImg);
       </script>
       ```
   

Het onderwerp ‘Live-chat in wordpress (javascript)’ is gesloten voor nieuwe reacties.

## Tags

 * [Body](https://nl.wordpress.org/support/topic-tag/body/)
 * [header](https://nl.wordpress.org/support/topic-tag/header/)
 * [javascript](https://nl.wordpress.org/support/topic-tag/javascript/)
 * [live-chat](https://nl.wordpress.org/support/topic-tag/live-chat/)
 * [wordpress](https://nl.wordpress.org/support/topic-tag/wordpress/)

 * In: [Algemeen WordPress](https://nl.wordpress.org/support/forum/algemeen/)
 * 0 reacties
 * 1 deelnemer
 * Laatste antwoord van: [elifecoach](https://nl.wordpress.org/support/users/elifecoach/)
 * Laatste activiteit: [16 jaren geleden](https://nl.wordpress.org/support/topic/live-chat-in-wordpress-javascript/)
 * Status: onopgelost

## Onderwerpen

### Meest populaire onderwerpen

### Onderwerpen zonder reacties

### Non-support onderwerpen

### Opgeloste onderwerpen

### Onopgeloste onderwerpen

### Alle onderwerpen
