• Post Reply Bookmark Topic Watch Topic
  • New Topic

Ajax Challenge  RSS feed

 
Liyaquat Ali
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having tried out Ajax for testing purposes I have noticed major issues with cross browser compatibility. Right from the way we create a XMLHttpRequest to the time we want to parse the XML Response we have to deal with different behaviour of javascript in different browsers. The code to parse XML is different for IE and Mozilla, I dont know about Netscape, Opera and others. I have realized that we end up duplicating code to deal with this issue.

Is there any way or getting around this?
[ April 25, 2006: Message edited by: Liyaquat Ali ]
 
Smitha Mathew
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We've been focusing on the Prototype library (http://prototype.conio.net/). It's really a javascript library that happens to include a few methods for simplifying Ajax calls on the client side.
It has crossbrowser implementation code and so we need not worry about the intricate details of browsers supporting different DOM objects.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except for creating the request object, I haven't found that much browser-depenendent code is necessary even when not using a 3rd-party library. Of course there are the usual other DHTML things that IE does wrong, but those are independent of Ajax itself, just more likely to be tripped upon when creating applications that are heavy on DHTML.
[ April 25, 2006: Message edited by: Bear Bibeault ]
 
Linda Walters
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The browser dependencies for AJAX are basically just IE vs. everybody else, so it is easy to just encapsulate that decision in a function. There are plenty of frameworks that address this and other issues.

There are much bigger cross-browser issues with HTML and CSS than this minor annoyance.
 
Liyaquat Ali
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Smitha for the link to http://prototype.conio.net/

Linda U mentioned that are other frameworks which can get around this browser incompatibility issue, would please provide the linx to the same if possible.

Has anyone heard of Jaxson, its a framework that Christian Gross(Author of Ajax Patterns and Best Practices) is working on, I have not been able to get much info about Jaxson.

Hasn't anyone faced the issue of code duplication when parsing the Ajax XMLResponse??
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by code duplication with parsing the XML. Show us your code. You may not be doing things right.

Eric
 
Brett McLaughlin
author
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As several have said, the only significant difference between browsers is in creating a request object: using XMLHttpRequest in Mozilla, Firefox, Opera, Safari, et. al., versus using ActiveXObject in Microsoft. But that is pretty easy to encapsulate and work around.

Other than that, there really aren't issues, assuming you're careful in your code. For instance, in Head Rush Ajax, some fairly complex DOM interactions, DHTML, XML parsing, JSON parsing, and CSS manipulation are performed, all without any browser-specific code. So it's mostly just being careful about what properties you use.

Thanks
Brett
 
Linda Walters
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liyaquat,

There are a number of frameworks including Dojo, also there is a pretty good, but simple framework that is used in (don't laugh) Ajax for Dummies and that has the code available from the Chapter 5 folder in the code from the book's website.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As several have said, the only significant difference between browsers is in creating a request object: using XMLHttpRequest in Mozilla, Firefox, Opera, Safari, et. al., versus using ActiveXObject in Microsoft. But that is pretty easy to encapsulate and work around.

And for those who don't know yet, this restriction is going to disappear with IE7
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this restriction is going to disappear with IE7

That's good news. But the restriction will actually disappear when nobody will use IE6 anymore
 
Liyaquat Ali
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Guyz ahemmmm n Galz,

I guess the XML Parsing code I have has a problem.

Linda, sorry, I didi laugh N I laughed again when I read "dont laugh", thanx for the linx will go through them soon.

Satou, U R right, the problem will dissapear only when ppl stop using IE6!

[ April 26, 2006: Message edited by: Liyaquat Ali ]
[ April 27, 2006: Message edited by: Liyaquat Ali ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liyaquat,

Use full words when you post of the forums! Not everyone speaks English here as I pointed out to you on another post.

Eric Pascarello
 
David Dong
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My two cents and a cake
Only use common Language..
 
Liyaquat Ali
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Thanks for the advice on using full words instead of short forms, I will definitelt keep it in mind next time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!