Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 5 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
jQuery is not going to help you write semantic HTML nor compliant and DRY CSS. –  Raynos Jul 3 '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. –  vemv Jul 3 '11 at 13:46

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.

share|improve this answer
    
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 3 '11 at 3: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 3 '11 at 8: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 3 '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 3 '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 3 '11 at 16:48

This answer may be a bit off-topic, I'd rather write it as a comment, but I don't have enough reputation for that.

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.

share|improve this answer
    
This and other related documents I can find in that site look incredibly useful. Cheers for the heads up! –  vemv Jul 3 '11 at 13:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.