I am working on an ajax chat application, done most of the work but when i tested it on IE (both on IE6 and IE7), found that there is a memory leak. The application works fine on FF. How can i fix this?
I have used ajax in the following way (this is a similar to how i am using ajax in my chat application); incrementer.php file on line # 34 simply prints an incremented value from the session
I have used ajax in the following way (this is a similar to how i am using ajax in my chat application); incrementer.php file on line # 34 simply prints an incremented value from the session
Code:
<html> <head> <script language="javascript"> function getAjaxObject(){ try{ ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser doesn't support ajax!"); return false; } } } return ajaxRequest; } function startCounting(){ var a=getAjaxObject(); a.onreadystatechange = function(){ if(a.readyState==4){ var text=a.responseText; var e=document.getElementById('val'); if(e){ e.innerHTML=text; } } } a.open("GET", "incrementer.php", true); a.send(null); setTimeout(startCounting,1); } </script> </head> <body> <input type="button" value="Send Object" onclick="startCounting()" /> <div id="val"> </div> </body> </html>
Comment