Sample code for self-hosted Instant Chat
Articles related to customization are written for a technical audience who have experience in web development. Knowledge of HTML, CSS, and JavaScript are required.
Di seguito è riportato un codice di esempio per Instant Chat self-hosted.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>YourCompany - Web Chat</title> <script type="text/javascript" src="https://secure.GoToLogMeIn Rescue.com/InstantChat/InstantChat.aspx"></script> <script type="text/javascript"> function loadInstantChat(sessionType) { // Show Instant Chat document.getElementById("InstantChatDiv").style.display = ""; // Hide Channel form document.getElementById("ChannelForm").style.display = "none"; // Hide PIN Code form document.getElementById("PinForm").style.display = "none"; // Hide Language dropdown document.getElementById("LanguageForm").style.display = "none"; var ICLoader = new LogMeIn RescueInstantChatLoader(); ICLoader.ICContainer = "InstantChatDiv"; ICLoader.HostedCSS = "http://YourSite/yourstylesheet.css"; ICLoader.HostedLanguagesForChatOnlyMode = "http://[YourSite]/LanguagesForChatOnlyMode.js"; ICLoader.HostedLanguagesForAppletMode = "http://[YourSite]/LanguagesForAppletMode.js"; // Il nome del dominio URL o il nome del dominio di [TuoSito] deve essere inserito nell'elenco del LogMeIn Rescue Centro amministrativo. // Contatta il tuo LogMeIn Rescue Master Administrator! // sessionType == 0, siamo dopo il REBOOT // Sessione canale if (sessionType == 1) ICLoader.EntryID = "123456789"; // Sessione privata if (sessionType == 2) { var pin = document.getElementById("inputPinCode").value; if ((pin.length = 6) || isNaN(pin)) { handleError("Il codice privato deve essere un numero di 6 cifre!"); return; } else ICLoader.PrivateCode = document.getElementById("inputPinCode").value; } ICLoader.Name = document.getElementById("inputYourName").value; ICLoader.Comment1 = document.getElementById("inputEmailAddress").value; ICLoader.Comment2 = document.getElementById("inputPhoneNumber").valore; ICLoader.Comment3 = document.getElementById("inputCompanyName").valore; ICLoader.Comment4 = document.getElementById("inputLocation").valore; ICLoader.Comment5 = document.getElementById("inputComment").value; ICLoader.Tracking0 = "TestForm01"; ICLoader.Language = document.getElementById("inputLanguageSelect").value; ICLoader.PostMessageTargetOrigin = null; //https://[YourSite].com<:443> // Errore + Nessun tecnico disponibile per la gestione delle notifiche ICLoader.HostedErrorHandler = function(ErrorName) { switch(ErrorName) { case "NOTECHAVAILABLE": handleError("Attualmente non ci sono tecnici disponibili. Ti invitiamo a tornare più tardi."); break; case "NOTECHWORKING": handleError("Spiacenti, siamo chiusi. Al momento non sono disponibili tecnici. Ti invitiamo a tornare più tardi durante il nostro orario di apertura."); break; case "INVALID_PARAMETERS": handleError("Parametri non validi forniti. Contatta il tuo fornitore di assistenza."); break; caso "SESSIONALREADYSTARTED": handleError("Una sessione che utilizza questo Codice PIN è già stata avviata. Chiedi al tuo fornitore di assistenza un nuovo Codice PIN."); break; case "UCONNECTIONERROR": handleError("Si è verificato un errore di connessione sconosciuta."); break; case "ERRNOSUCHSSESSION": handleError("La sessione di supporto non può essere avviata"); break; case "ERRNOSUCHENTRY": handleError("La sessione di supporto online non può essere avviata. Contatta direttamente il tuo fornitore di assistenza."); break; caso "ERRCODEDOESNOTEXIST": handleError("Il Codice PIN non esiste. Contatta il tuo fornitore di assistenza."); break; caso "ERRCODEEXPIRED": handleError("Il Codice PIN è scaduto. Contatta il tuo fornitore di assistenza."); break; case "ERRNOTEXPIRED": handleError("Il tecnico o l'azienda non esiste. Contatta il tuo fornitore di assistenza."); break; caso "ERRMISSINGTECHLICENSE": handleError("La sessione di supporto non può essere avviata. The technician is not configured to support this type of device."); break; } } ICLoader.Start(); } // Start automatically Instant Chat after REBOOT function handleReboot() { if ((window.location + "").indexOf("LogMeIn Rescuewebsessionid") != -1) loadInstantChat(0); if (window.location.hash.length == webSessionIdLength + 1) loadInstantChat(0); } // Show error messages function handleError(ErrorDescription) { // Hide Instant Chat document.getElementById("InstantChatDiv").style.display = "none"; // Show ErrorForm var ef = document.getElementById("ErrorForm"); ef.style.display = ""; ef.innerHTML = ErrorDescription; } </script> </head> <body onload="handleReboot();" style="background-color: #000000; font-family:tahoma, arial, verdana; color: #FFFFFF"> <noscript> <div style="position: absolute; left: 0px; top: 0px; width: 700px; height: 700px; zindex: 1; background-color: #000000"> Per utilizzare questa funzione Instant Chat assicurati di aver attivato la funzione JavaScript <br /> Una volta abilitata, aggiorna la pagina. JavaScript aggiorna la pagina. </div> </noscript> <div id="ChannelForm" style="position: absolute; left: 100px; top: 100px; backgroundcolor: #303030; padding: 20px 20px 20px 20px"> Il tuo nome<br /> <input id="inputYourName" type="text" maxlength="64" style="width: 200px" /><br /> Indirizzo e-mail<br /> <input id="inputEmailAddress" type="text" maxlength="512" style="width: 200px" /><br /> Numero di telefono<br /> <input id="inputPhoneNumber" type="text" maxlength="512" style="width: 200px" /><br /> Nome Azienda<br /> <input id="inputCompanyName" type="text" maxlength="256" style="width: 200px" /><br /> Località<br /> <input id="inputLocation" type="text" maxlength="64" style="width: 200px" /><br /> Commento<br /> <input id="inputComment" type="text" maxlength="64" style="width: 200px" /><br /><br /> <input type="button" value="Inizia ora la chat" onclick="loadInstantChat(1);" /> </div> <div id="PinForm" style="position: absolute; left: 400px; top: 100px; background-color: #303030; padding: 20px 20px 20px 20px"> Inserisci il tuo codice PIN di 6 cifre<br /> <input id="inputPinCode" type="text" maxlength="64" style="width: 200px" /><br /><br /> <input type="button" value="Connettiti al tecnico" onclick="loadInstantChat(2);" /> </div> <div id=""LanguageForm" style="position: absolute; left: 400px; top: 260px; backgroundcolor: #303030; padding: 20px 20px 20px 20px"> Seleziona la lingua della chat<br />interfaccia<br /> <select id="inputLanguageSelect" style="width: 200px"> <option value="en">English</option> <option value="es">Español</option> <option value="de">Deutsch</option> <option value="fr">Français</option> <option value="it">Italiano</option> <option value="nl">Nederlands</option> <option value="pt">Português</option> <option value="pt-br">Português (Br)</option> <option value="hu">Portoghese</option> <option value="hu" >Portoghese (Br)option value="hu">Magyar</option> <option value="ru">Russo</option> <option value="ja">Giapponese</option> <option value="ko">Coreano</option> <option value="zh">Cinese semplificato</option> <option value="zh-tw">Cinese tradizionale</option> <option value="ar">Arabo </option <option value="tr">Türk</option> <option value="pl">Polski</option> <option value="fi">Suomalainen</option> <option value="sv">Svensk</option> <option value="no">Norsk</option> <option value="he">Ebraico</option> <option value="da">Dansk</option> <option value="cs">Czech</option> </select> </div> <div id="ErrorForm" style="position: absolute; left: 100px; top: 100px; height: 200px; width: 300px; background-color: #303030; padding: 20px 20px 20px 20px; display: none"></div> <div id="InstantChatDiv" style="position: absolute; left: 100px; top: 100px; width: 285px; height: 259px; display: none"></div> </body> </html>
Note:
- Instant Chat utilizza sempre documenti di tipo XHTML 1.0 Transitional, ma sono supportati anche documenti di tipo HTML meno recenti.
- La seguente riga deve indicare sempre InstantChat.aspx:
<script type="text/javascript" src="https://secure.GoToLogMeIn Rescue.com/InstantChat/InstantChat.aspx"></script>
- ICContainer è un parametro richiesto, l'iframe di Instant Chat verrà caricato nell'elemento ICContainer:
ICLoader.ICContainer = "ICContainer";
- Per informazioni sulla personalizzazione InstantChat.css, vedi Customize InstantChat.css.
- È possibile definire un parametro PrivateCode anziché il parametro EntryID per avviare sessioni Private in
ICLoader.EntryID = "1234567890";
- È possibile definire il codice della lingua predefinita (la lingua predefinita è "en"). Vedi anche Customize Instant Chat language files.
GoTo offre le seguenti lingue:
Abbreviazione (valore) Lingua Abbreviazione (valore) Lingua en Inglese zh Cinese semplificato it Spagnolo zh-tw Cinese tradizionale de Tedesco ar Arabo fr Francese tr Turco it Italiano pl Polacco nl Olandese fi Finlandese pt Portoghese sv Svedese pt-br Portoghese (BR) no Norvegese hu Ungherese he Ebraico ru Russo da Danese ja Giapponese cs Ceco ko Coreano el Greco th Thailandese ro Rumeno bg Bulgaro sk Slovacco hr Croato - La gestione degli errori host funziona come segue:
- Rimuovi il handleReboot funzione se ICContainer è sempre visibile nella pagina:
funzione handleReboot(){...}
- Visualizzazione automatica di Instant Chat dopo il riavvio. Rimuovere questa riga se il tuo ICContainer è sempre visibile nella pagina:
if ((window.location + "").indexOf("LogMeIn Rescuewebsessionid") != - 1){document.getElementById("ICContainer").style.display="" ; loadInstantChat();} /* opzionale */
- Rimuovi il handleReboot funzione se ICContainer è sempre visibile nella pagina:
Article last updated: 11 July, 2023
You are viewing the latest version of this article.