• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

PHP AJAX CHAT, Bug fixes - including weird mozilla bug ...

When I released PHP AJAX chat I knew that there was a problem with a few of the build of Firefox that didn’t like having SetTimeouts() outside of functions and requestobjects opening without full parameters. Well I have now fixed that and here is the patch. To install the patch do the following.

   1. Open up index.php oh php ajax chat archive
   2. find where this line is <script type=”text/javascript”> in mine it’s around line 33 and also find the end </script> which is around line 99.
   3. Hilight this area and replace it with the following code

function sndReq(doit) {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject(”Msxml2.XMLHTTP”);
} catch (e) {
try {
xmlhttp = new ActiveXObject(”Microsoft.XMLHTTP”);
} catch (E) {
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != ‘undefined’) {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
httpr = xmlhttp;

if(doit){
chatsend = document.getElementById(”textbox”).value;
guyname = document.getElementById(”guyname”).value;
parameters = “nick=”+encodeURI(guyname)+”&textbox=”+encodeURI(chatsend);
httpr.onreadystatechange = handleResponse;
httpr.open(”POST”, “<?php echo $url;?>rpc.php”,true);
httpr.setRequestHeader(”Content-type”, “application/x-www-form-urlencoded”);
httpr.setRequestHeader(”Content-length”, parameters.length);
httpr.send(parameters);
document.getElementById(’textbox’).value = ”;
}else{
httpr.onreadystatechange = handleResponse;
httpr.open(”GET”,”<?php echo $url;?>rpc.php”,true);
httpr.send(null);
}
setTimeout(”sndReq(false)”,2000);
}

function handleResponse() {
if(httpr && httpr.readyState == 4){
var response = httpr.responseText;
document.getElementById(”chatbox”).innerHTML = response;
}
}
function formsubmit(e){
characterCode = null;
if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4’s which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE’s keyCode property
}
if(characterCode == 13){
sndReq(true);
}
}
sndReq(false);

source: hawkenterprises

 Original Source:

AddThis Social Bookmark Button

Posted at 11:35:03 am | Permalink | Posted in Chat  PHP  

Related Stuff

  • MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.

  • Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone

  • TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support

  • ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.

  • Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.

  • Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software

  • PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Top Stuff

MessengerFX

e-messenger

ILoveIM

Top 20 Ruby CMS

eBuddy

MSN Web Messenger



About Ajaxlines

Ajaxlines is a project focused on providing its audience with a database of most of Ajax related articles, resources, tutorials and services from around the world.

Its purpose is to showcase the power of Ajax and to act as a portal to the Ajax development community.


Search


Topics

  • .Net (164)
  • Ajax (82)
  • Ajax Games (10)
  • Articles (95)
  • Bookmarking (35)
  • Calendar (20)
  • Chat (45)
  • ColdFusion (3)
  • CSS (75)
  • Email (23)
  • Facebook (83)
  • Flash (19)
  • Google (54)
  • Html (27)
  • Image (11)
  • International Calls & VOIP (7)
  • Java (54)
  • Javascript (265)
  • jQuery (159)
  • JSON (61)
  • Perl (2)
  • PHP (156)
  • Presentation (19)
  • Python (3)
  • Resources (2)
  • RSS (8)
  • Ruby (31)
  • Storage (4)
  • Toolkits (103)
  • Tutorials (217)
  • UI (11)
  • Utilities (174)
  • Web2.0 (18)
  • XmlHttpRequest (28)
  • YUI (12)

© 2006 www.ajaxlines.com. All Rights Reserved. Powered by IRange