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
  • 3
  • 20
  • 26

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
  • 198,589
  • 55
  • 464
  • 673
Jon
  • 321
  • 3
  • 8
  • jQuery is not going to help you write semantic HTML nor compliant and DRY CSS. – Raynos Jul 03 '11 at 12:08
  • Thank you very much @Jon, I was aware that JQ was a widely used JS library but I didn't know it favoured compatibility as well. I'll take @Raynos remarks into account, too. – deprecated Jul 03 '11 at 13:46
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
  • 5,973
  • 2
  • 31
  • 27
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,562
  • 33
  • 47
  • I think he's asking if it's ok to worry about compatibility after development is done. I've never seen anyone verify consistency across IE/Chrome/Safari after *each* added feature. Nothing wrong w/ banging out the code in one place then tidying up across platforms in the end. – hyperslug Jul 03 '11 at 03:28
  • I would add that you should NOT support IE6 (unless your market is china and I doubt that) even 7 is borderline today, you should not encourage people to stay with these old versions by supporting them. Being that you are not a money making business you should use the liberty to not support platforms. – Ziv Jul 03 '11 at 08:26
  • @hyperslug that's bad practice. It's nightmare to fix your html & css to look good in IE8 after you've done the entire website. It's even worse to fix it for firefox after you've done the entire website in I E. @Ziv I agree. IE6/7 support is only neccesary in enterprise / government where there too stupid to upgrade. – Raynos Jul 03 '11 at 12:07
  • @Raynos, are you saying that fixing little nightmares as you go somehow add up to less than having one big one at the end? If you're coding the exact same website, it should be close to equal. The issue I have is with context switching. – hyperslug Jul 03 '11 at 15:26
  • @hyperslug I'm saying that iterative development is better then waterfall. The exact same argument applies here. The process is simply TDD and running your tests in all browsers. – Raynos Jul 03 '11 at 16:48
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.

Pierre.Vriens
  • 233
  • 1
  • 2
  • 11
Teo.sk
  • 131
  • 1
  • 4