+ Start a Discussion
Alexander RochaAlexander Rocha 

Live Agent - Prechat error


How are you all?
I'm trying to implement a prechat code in my page, and when I submit the form, I get an error like this "The chat window can only be opened with a button - can not access it directly."

Default code is being used (from live agent doc):

<apex:page showHeader="false">
    <!-- This script takes the endpoint URL parameter passed from the deployment
      page and makes it the action for the form -->
    <script type="text/javascript">
         (function() {
         function handlePageLoad() {
           var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
         } if (window.addEventListener) {
                  window.addEventListener('load', handlePageLoad, false);
       } else { window.attachEvent('onload', handlePageLoad, false);
    <h1>Pre-chat Form</h1>
    <form method='post' id='prechatForm'>
          First name: <input type='text' name='liveagent.prechat:FirstNameDetail'
            id='customField1' /><br />
          Last name: <input type='text' name='liveagent.prechat:LastNameDetail'
            id='customField2' /><br />
          Department: <select name="liveagent.prechat.buttons">
              <!-- Values are LiveChatButton IDs. -->
              <option value="573a00000000001">Customer Service</option>
              <option value="573a00000000002">Technical Support</option>
              <option value="573a00000000001,573a00000000002">Customer Service if online,
              otherwise Technical Support</option>
          </select><br />
          <input type='submit' value='Request Chat' id='prechat_submit'/>
    <style type="text/css">
    p {font-weight: bolder }

ShashankShashank (Salesforce Developers) 
If you are using internet explorer, please ensure "protected mode" is turned off, as it is not recommended by salesforce.