views:

26

answers:

2

I only have about 2 yrs experience of web development under my belt, so I may be missing something quite simple....

I created a heavy javascript file that I dropped into the header of my company's intranet. It uses jquery and ajax calls to create a messenger similar to facebook or gmail's messenger.

When the page loads, every 20 sec the fixed div updates the # of messages there are.

This works fine on Firefox and IE for XP, Vista, Windows 7, Mac OS 10.4 (G4).

On Mac OS 10.4 (G5) and Mac OS 10.5 (Intel), it doesn't work as expected...

When the page loads, firebug shows that the parameters are passed as expected and the response is returned as expected, but for some reason, firebug displays the call in red and of course the changes are not updated. Here is the code:

function check_for_messages(){
                // Takes care of IE's caching
        var iedumb= d.getDate().toString() + d.getHours().toString() + d.getMinutes().toString() + d.getMilliseconds().toString();

                // id is the user's id, page returns # of messages
        $.ajax({
            dataType: 'html',
            url: url+'check_messages.asp?id='+$('#messenger-user-id').val()+'&iedumb='+iedumb,
            success: function(data) {
                if( parseInt(data) >= 0)
                    $('#messenger-new-messages').text("("+data+")");            
            }
        });

        d = new Date();
        timer = setTimeout(check_for_messages, mil_seconds);
}

According to firebug, the parameters and response look fine, but it still doesn't seem to work. I've tried Safari as well, which gave the same results. I suspect this has to do with user preferences, but I'm really unsure. It's been two full days and I'm out of ideas. Any suggestions would be highly appreciated.

A: 

See if you get different (and maybe more revealing) error messages using Safari's developer menu and JS debugger. Safari/Preferences/Advanced/

songdogtech
Thanks for the response SongDogTech. Sorry this took so long for me to respond.Using this I was able to compare the request header data.
Chris
A: 

I compared the request header data between browsers and noticed that the 'Referrer' differed. On the working browser, the referrer was http://ourintranetsite.com. On the browser that didn't work, the referrer was http://.

I was using full URL paths for my ajax calls so I made these relative and the referrers were correct and everything worked fine.

With that, I was curious why this occurred? Since I had 'http://' did the browser think I was trying to call for a response from another domain, hence being a security concern and failing? Thanks

Chris