i downloaded a facebook-like chat application, i edited it to fit for my website but i’m having problem with keeping the chat session open while navigating other pages.. thanks to all that try to help initially, some suggested AJAX request.. i tried it out with this code
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("site-body-content").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","index.php",true);
xmlhttp.send();
}
each time i create a link, i’ll have to re-write this function changing the name and the page in
xmlhttp.open(“GET”, “pagename”, true);
what i want to do now is to save the stress of re-writing a function for each page created.
There is no such thing as a ‘div window’.
Facebook does it by updating the url in the bar, but requesting the new page information through an AJAX request, effectively avoiding what would be considered normal navigation.