+ Start a Discussion
Li ChenLi Chen 

Encounter HTTP 500 Error after click Online-button of Live Agent visitor page on own web-server

Hi All,

We are implement Live Agent feature and configure skill and users, and tried to integrate with our own web-portal.
By Running sample script genereated by Salesforce from Local laptop, it's working well, can see online/offline of agents, also can do Live chat with agents.

When we deploy to our own Tomcat-Apache web-server, we are able to see the online/offline button, but after i click on the Online button the chat window pops up with an error as below:

HTTP ERROR: 500

Problem accessing /content/s/prechatVisitor. Reason:

This is not a JSON Array.
Powered by Jetty://


And URL call in browser looks like below strang url: 
https://9t.la9cs.salesforceliveagent.com/content/s/prechatVisitor?endpoint=https%3A%2F%2F9t.la9cs.salesforceliveagent.com%2Fcontent%2Fs%2Fchat%3Flan......................

I already saw there are two similar discussions on the forum without answer.

Any one could give some help? Thanks!

The Sample HTML script are as below:

<html>
<head></head>
<body>

<img id="liveagent_button_online_573O0000000CaUz" style="display: none; border: 0px none; cursor: pointer" onclick="liveagent.startChat('573O0000000CaUz')" src="https://uat-libertyinsurancesg.cs5.force.com/survey/resource/1421128309000/Live_Agent_online_button" /><img id="liveagent_button_offline_573O0000000CaUz" style="display: none; border: 0px none; " src="https://uat-libertyinsurancesg.cs5.force.com/survey/resource/1421129020000/Live_Agent_offline_button" />
<script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('573O0000000CaUz', document.getElementById('liveagent_button_online_573O0000000CaUz'));
liveagent.showWhenOffline('573O0000000CaUz', document.getElementById('liveagent_button_offline_573O0000000CaUz'));
});</script>


<script type='text/javascript' src='https://c.la9cs.salesforceliveagent.com/content/g/js/32.0/deployment.js'></script>
<script type='text/javascript'>
liveagent.addCustomDetail('Company Name', 'Company ABC');
liveagent.setName('John Doe');
liveagent.init('https://d.la9cs.salesforceliveagent.com/chat', '572O0000000CaT3', '00DO00000050jEO');
</script>
</body>
</html>



 
Best Answer chosen by Li Chen
Li ChenLi Chen
There's a comment from another discussion really help to solve the problem:
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AdVQ

Below code can be placed somewhere above/before the liveagent.init call.
<script type="text/javascript> 
    if(window.Prototype) {
        delete Object.prototype.toJSON;
        delete Array.prototype.toJSON;
        delete Hash.prototype.toJSON;
        delete String.prototype.toJSON;
    }
</script>

After added this code, the Live agent client page is working fine for most of browsers.
For IE9, it requires additional configuration in IE9 broswer:
 1. Turn off the "compatibility mode" for all the sites
2. Add *.salesforceliveagent.com into Intranet Site
3. Enable "Running Script"

All Answers

Li ChenLi Chen
Any one has similar issue or suggest, thanks !! 
Li ChenLi Chen
After contact Salesforce support, Salesforce push us to here, but no response after two weeks...
Li ChenLi Chen
There's a comment from another discussion really help to solve the problem:
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AdVQ

Below code can be placed somewhere above/before the liveagent.init call.
<script type="text/javascript> 
    if(window.Prototype) {
        delete Object.prototype.toJSON;
        delete Array.prototype.toJSON;
        delete Hash.prototype.toJSON;
        delete String.prototype.toJSON;
    }
</script>

After added this code, the Live agent client page is working fine for most of browsers.
For IE9, it requires additional configuration in IE9 broswer:
 1. Turn off the "compatibility mode" for all the sites
2. Add *.salesforceliveagent.com into Intranet Site
3. Enable "Running Script"
This was selected as the best answer
Andrea IanniAndrea Ianni
Hi Li,

i have the same issue of you. I cannot understand how you use your code.
Is it possible you did something like:
 
<script type="text/javascript"> 
    if(window.Prototype) {
        delete Object.prototype.toJSON;
        delete Array.prototype.toJSON;
        delete Hash.prototype.toJSON;
        delete String.prototype.toJSON;
    }
</script>

<script type='text/javascript' src='https://c.la1-c1cs-lon.salesforceliveagent.com/content/g/js/34.0/deployment.js'></script>
<script>
    window.alert("Stai per essere reindirizzato sul LiveAgent.");
    
   
    //----------------------------------------------------------------------------------------------------------
    liveagent.addCustomDetail("IdAOL", new Date().getTime());
    liveagent.findOrCreate("Info__c").map("ID_AOL__c", "IdAOL", false, false,true);
    liveagent.findOrCreate("Info__c").showOnCreate();
    liveagent.findOrCreate("Info__c").saveToTranscript("Info__c","Info__c");
    liveagent.findOrCreate("Survey_Operatore__c").map("ID_AOL__c", "IdAOL", false, false,true);
    liveagent.findOrCreate("Survey_Operatore__c").showOnCreate();       
    liveagent.findOrCreate("Survey_Operatore__c").saveToTranscript("Survey_Operatore__c","Survey_Operatore__c");
    
    
    
    liveagent.init('https://d.la1-c1cs-lon.salesforceliveagent.com/chat', '57225000000XXXV', '00D25000000XXXX');
    //----------------------------------------------------------------------------------------------------------
    // avvio della chat
    liveagent.startChat('573250000008OLT', true);