Forum Moderators: open

Message Too Old, No Replies

AJAX issue with safari

Common problem, I bet

         

adni18

2:01 am on Feb 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there, I've been playing around with AJAX a bit, and can't seem to get a live newsfeed I'm working on to work in Safari. I think I've narrowed down the problem: for some reason xmlHTTP.responseText returns null, and I'm not sure why. Any suggestions? Thanks!

Here's some code:


function ajaxFunction()
{
var xmlHttp;

try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX! Please download the latest version of firefox at [getfirefox.com...] .");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{

if(xmlHttp.readyState==4)
{
alert(xmlHttp.responseText) // This returns null.

window.setTimeout("ajaxFunction()", 5000);
}
}
xmlHttp.open("GET","livefeed.php",true);
xmlHttp.send(null);
}

scriptmasterdel

1:41 pm on Feb 18, 2007 (gmt 0)

10+ Year Member



I am sorry i can not help you but i think you are right it does look like a common problem, i took a little look around on the internet and i found one or two other people with the same problem - but no solution.

I am very interested in helping you. What version of safari are you using?

Del

adni18

11:24 pm on Mar 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm using v2.0.4.

adni18

8:15 pm on Mar 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does anybody have a solution?

Fotiman

8:46 pm on Mar 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You could try using the Yahoo UI Library [developer.yahoo.com]'s Connection Manager [developer.yahoo.com] to handle your AJAX requests. It's cross-browser compatible.

adni18

9:23 pm on Mar 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, I have switched to this, and Safari appears to work with it, but only once, and afterwards it gives me an error: "communications failure".

Fotiman

3:14 pm on Mar 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There is a pretty good email support list for the YUI stuff, so you might try sending your specific issue to that list.

cmarshall

7:19 pm on Mar 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



adni18: Check your SM.