function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mohan N 17Mohan N 17 

Getting Connection Lost: Please check your local connection error while using prechat form

Hi,

I'm implementing live agent by using prechat form url and getting an error as Connection Lost: Please check your local connection.
If I tried without prechat form url I'm not getting error & I'm not getting any ideas can anyone help for this bcoz we are in last date for our project.

my button,deployment code is:
<html>    
<body>

<h3>Chat</h3>
<p>
    <!-- Button code starts -->
<a id="liveagent_button_online_573p00000004C98" href="javascript://Chat" style="display: none;" onclick="liveagent.startChat('573p00000004C98')">Support Enquiry</a>
<div id="liveagent_button_offline_573p00000004C98" style="display: none;">Sorry! currently we are offline. <br/>please,write us at care@industrybuying.com</div>
<script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('573p00000004C98', document.getElementById('liveagent_button_online_573p00000004C98'));
liveagent.showWhenOffline('573p00000004C98', document.getElementById('liveagent_button_offline_573p00000004C98'));
});</script>
    <!-- Deployment code starts -->
<script type='text/javascript' src='https://c.la9cs.salesforceliveagent.com/content/g/js/35.0/deployment.js'></script>
<script type='text/javascript'>
liveagent.init('https://d.la9cs.salesforceliveagent.com/chat', '572p00000004C98', '00Dp00000000Pj8');
</script>

</body>
</html>

My prechat form is:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
(function() { 
  function handlePageLoad() {
    var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
    document.getElementById('prechatForm').setAttribute('action',
    decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
  } 
  if (window.addEventListener) {
    window.addEventListener('load', handlePageLoad, false);
  } else { 
    window.attachEvent('onload', handlePageLoad, false);
  }
})(); 
</script>
</head>
<body bgcolor="#f3f3f3">
<div id="chatFormDiv" float="left" align="center">
     <span id="chatHeader">Please fill the following details to start Chat</span><br/>
    <hr color="#000"/>
<form method="post" id="prechatForm" align="middle">
<!-- Detail inputs -->
    
    Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="liveagent.prechat:contactLastName" required="required"/><br /><br />
    Email &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="liveagent.prechat:contactEmail" required="required"/><br /><br />
    Phone &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="liveagent.prechat:contactPhone" /><br /><br />
    Subject &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="liveagent.prechat:caseSubject" /><br /><br />
  
<input type="hidden" name="liveagent.prechat.buttons" value="true" />

<!-- Map the detail inputs to the Contact fields --> 
<input type="hidden" name="liveagent.prechat.findorcreate.map:Contact" value="LastName,contactLastName;Email,contactEmail;" />

<!-- Try to find the Contact by email (exact match) -->
<input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Contact" value="Email,true;" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Contact" value="Email,true;" />

<!-- If the Contact is not found, then create one with the following fields set -->
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Contact" value="LastName,true;Email,true;" />

<!-- Save the Contact on the Live Chat Transcript's Contact Loookup -->
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Contact" value="Contact" />

<!-- Show the Contact when it is found or created -->
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Contact" value="true" />

<!-- Create a Case every time -->
<input type="hidden" name="liveagent.prechat:caseOrigin" value="Chat" />
<input type="hidden" name="liveagent.prechat:caseRecordType" value="Live Chat" />
<input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Origin,caseOrigin;Subject,caseSubject;RecordType,caseRecordType;" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Case" value="Origin,true;Subject,true;RecordType,true;" />
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Case" value="Case" />
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" />

<!-- Link the Contact to the Case -->
<input type= "hidden" name="liveagent.prechat.findorcreate.linkToEntity:Contact" value="Case,ContactId" />

<input type="submit" value="Start Chat" id="prechat_submit"/> 

</form> 
</div>
</body>
</html>

Thanks
Mohan.
pconpcon
Where are you hosting your prechat form?  It doesn't look like you specify anywhere what you are POSTing to in your form, you just have method=post but no action attribute.

NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
Mohan N 17Mohan N 17
Hi pcon,

Thanks for your response
I used <form method="post" id="prechatForm" align="middle">  in prechat form which was added already
and I gave url in
chat button configuration -->pre chat form url field in saleforce.