Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > AJAX works in IE6 but not IE7 or Firefox

Reply
Thread Tools

AJAX works in IE6 but not IE7 or Firefox

 
 
Steve Wright
Guest
Posts: n/a
 
      03-13-2007
I have an AJAX routine on a webpage that is working in IE6, but not IE7
or Firefox v2.0.0.2

The webpage is

http://www.a-drop-in-the-ocean.co.uk...php?quarry=401

The AJAX routine is encapsulated in the module

http://www.a-drop-in-the-ocean.co.uk/CWS/js/timer.js

What it is supposed to do is every ten seconds, read the contents of the
file http://www.a-drop-in-the-ocean.co.uk/CWS/401/seqno.txt. This file
just contains the number 46955. If this number changes then the page
will refresh.

The timer routine, counts down the 10 seconds, displaying the counter in
the top right hand corner. Once the counter hits zero, it triggers the
AJAX request.

The onload event also triggers the AJAX request to get the initial value
of the number.

I presume that IE7 and FF use the XMLHttpRequest() function and that I
must have coded this incorrectly. But what is wrong with it?

Interestingly, the firebug extension in FF, shows the request and
response headers along with the response 46955.

Fixing this is not critical at the moment as IE6 is our company
standard. But at some stage we will migrate to IE7...

Has anybody got any ideas?
--
Steve Wright
 
Reply With Quote
 
 
 
 
Jeremy
Guest
Posts: n/a
 
      03-13-2007
Steve Wright wrote:
> I have an AJAX routine on a webpage that is working in IE6, but not IE7
> or Firefox v2.0.0.2
>
> The webpage is
>
> http://www.a-drop-in-the-ocean.co.uk...php?quarry=401
>
> The AJAX routine is encapsulated in the module
>
> http://www.a-drop-in-the-ocean.co.uk/CWS/js/timer.js
>
> What it is supposed to do is every ten seconds, read the contents of the
> file http://www.a-drop-in-the-ocean.co.uk/CWS/401/seqno.txt. This file
> just contains the number 46955. If this number changes then the page
> will refresh.
>
> The timer routine, counts down the 10 seconds, displaying the counter in
> the top right hand corner. Once the counter hits zero, it triggers the
> AJAX request.
>
> The onload event also triggers the AJAX request to get the initial value
> of the number.
>
> I presume that IE7 and FF use the XMLHttpRequest() function and that I
> must have coded this incorrectly. But what is wrong with it?
>
> Interestingly, the firebug extension in FF, shows the request and
> response headers along with the response 46955.
>
> Fixing this is not critical at the moment as IE6 is our company
> standard. But at some stage we will migrate to IE7...
>
> Has anybody got any ideas?


What is not working about it? The AJAX code looks like it should work
in both firefox and IE, so I don't think that's your problem.

I would guess off the top of my head that the response is getting cached
(despite sending if-modified-since) and so you're not getting back an
updated response. There are a lot of ways to prevent this, such as
using a POST request instead of GET and/or appending a randomized query
string.

Jeremy
 
Reply With Quote
 
 
 
 
Erwin Moller
Guest
Posts: n/a
 
      03-13-2007
Steve Wright wrote:

> I have an AJAX routine on a webpage that is working in IE6, but not IE7
> or Firefox v2.0.0.2
>
> The webpage is
>
> http://www.a-drop-in-the-ocean.co.uk...php?quarry=401
>
> The AJAX routine is encapsulated in the module
>
> http://www.a-drop-in-the-ocean.co.uk/CWS/js/timer.js
>
> What it is supposed to do is every ten seconds, read the contents of the
> file http://www.a-drop-in-the-ocean.co.uk/CWS/401/seqno.txt. This file
> just contains the number 46955. If this number changes then the page
> will refresh.
>
> The timer routine, counts down the 10 seconds, displaying the counter in
> the top right hand corner. Once the counter hits zero, it triggers the
> AJAX request.
>
> The onload event also triggers the AJAX request to get the initial value
> of the number.
>
> I presume that IE7 and FF use the XMLHttpRequest() function and that I
> must have coded this incorrectly. But what is wrong with it?
>
> Interestingly, the firebug extension in FF, shows the request and
> response headers along with the response 46955.
>
> Fixing this is not critical at the moment as IE6 is our company
> standard. But at some stage we will migrate to IE7...
>
> Has anybody got any ideas?


Hi,

go to: www.w3schools.com

Follow the AJAX link.
Read through it. It won't take more than 15 minutes if you are familiar with
JS.
You will find a nice routine at the end that gives you your xmlhttprequest
on all platforms that support it.

Regards,
Erwin Moller

PS: Shame your company isn't migrating to FF.

 
Reply With Quote
 
Bart Lateur
Guest
Posts: n/a
 
      03-14-2007
Steve Wright wrote:

>Has anybody got any ideas?


Your request.open call only has 2 parameters,

request.open ('get', url);

the docs for XMLHttpRequest for Mozilla/Firefox say it needs 3 -- and
last time I chaked, Firefox does indeed need the 3rd parameter.

req.open('GET', 'http://www.mozilla.org/', false);

<http://developer.mozilla.org/en/docs/XMLHttpRequest>

HTH

--
Bart.
 
Reply With Quote
 
Steve Wright
Guest
Posts: n/a
 
      03-15-2007
On Mar 14, 7:06 pm, Bart Lateur <(E-Mail Removed)> wrote:
> Steve Wright wrote:
> >Has anybody got any ideas?

>
> Your request.open call only has 2 parameters,
>
> request.open ('get', url);
>
> the docs for XMLHttpRequest for Mozilla/Firefox say it needs 3 -- and
> last time I checked, Firefox does indeed need the 3rd parameter.
>
> req.open('GET', 'http://www.mozilla.org/', false);
>
> <http://developer.mozilla.org/en/docs/XMLHttpRequest>


Whilst you are correct, that is not the root cause of the problem.

I have changed the request.open to pass true as the 3rd parameter, but
this has no effect in Firefox.

(Please note I am trying this at work, so I haven't changed the
version I posted to the group yet - I'll do that tonight).

My next idea is to rewrite using the prototype library routines (if I
can get my head around them)

 
Reply With Quote
 
Bart Lateur
Guest
Posts: n/a
 
      03-15-2007
Steve Wright wrote:

>> req.open('GET', 'http://www.mozilla.org/', false);
>>
>> <http://developer.mozilla.org/en/docs/XMLHttpRequest>

>
>Whilst you are correct, that is not the root cause of the problem.
>
>I have changed the request.open to pass true as the 3rd parameter, but
>this has no effect in Firefox.


While that may be true, in my haste, I got the value of the parameter
wrong. It is false for synchronous, and true for asynchronous mode. As a
note on the page says:

Note: This example works synchronously, so it will block the
user interface if you call this from your JavaScript. You should
not use this in practice.

--
Bart.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Authentication in IIS7 works in FireFox but not in IE7/8 APA ASP .Net 0 01-11-2010 11:31 PM
Page shows in FIrefox, IE7 but not IE6 OccasionalFlyer HTML 4 12-05-2008 02:49 AM
My movement of banner is not working in IE6, works in IE7 and Firefox, and Safari Terry Javascript 1 10-20-2007 09:38 PM
what's wrong with this iframe? (works in Firefox, but not IE7) Aidan HTML 4 06-07-2007 06:09 AM
Script works with IE6 but not with IE7 Manfred Javascript 3 02-07-2007 12:28 PM



Advertisments