5

As one of my summer projects I'd like to build an AJAX program on my own. Not too big. I'm new to the whole matter, however I have general knowledge in programming and a good understanding of the Web workflow.

As for W3C standards, is it wrong sticking to them as if they were a platform?

Is it a good idea to code having a single platform in mind (i.e. Firefox 3 + Win7) and make it cross-browser after the initial code is finished?

In general, to what extent is browser compatibility a problem these days?

deprecated
  • 3,297

4 Answers4

13

If it's cross platform JavaScript compatibility you are after, you may want to take a good look at jQuery jQuery is specifically designed to alleviate many of the cross-browser headaches inherent in JavaScript/DOM development.

Robert Harvey
  • 200,592
Jon
  • 321
6

I would go for 2 main directions :

  • Use a framework. jQuery, mootools, prototype, or some others are great. They will handle most of quircks that you can encounter between browsers.
  • Use a testing tool that can generate a report of your code on several browsers. The basic solution is to write unit test suite (for exemple with QUnit) and then run them to browser specified with the client. You can also have a look at testSwarm or similar projet to get more automation.

And don't forget : do not try to detect browser/JS engine. Detect capabilities instead, or you are starting a endless debugging with every new browser comming on the place. Have a look at modernizr for that, this is an usefull tool.

Anyway this is a difficult goal to achieve. Those are tip that will help you with that. But the key point is debugging and testing to avoid regression on a specific plateform.

deadalnix
  • 6,023
3

As for W3C standards, is it wrong sticking to them as if they were a platform?

Not at all, it's best practice to code to the w3c standards

Is it a good idea to code having a single platform in mind (i.e. Firefox 3 + Win7) and make it cross-browser after the initial code is finished?

No it's not. Please code to the standards (W3C and EcmaScript). If it's not working in a specific browser fix it for that browser (mostly IE6-8).

In general, to what extent is browser compatibility a problem these days?

Depends, do you want to support IE6-8 ? If not then write to the standards all the major browsers will just work out of the box.

Raynos
  • 8,590
3

This answer may be a bit off-topic.

I'd like to recommend you a very useful presentation by Addy Osmani, who very nicely sums up everything that is necessary to build a good web application using Java Script.

To answer your question - headaches from cross-browser testing can be minimized using tools mentioned in the presentation.

Teo.sk
  • 131