Forgot your password?
typodupeerror

Comment Browser compatibility (Score 1) 528

I'm going to risk sounding like a smug git here, but you really don't have to write any browser-specific code for these three. I develop for Opera, Firefox and IE simultaneously (and I'm going to include Safari as soon as I can convince the company we need a Mac) and all of my code works without any major differences.

In fact the only browser specific code blocks I have to use (that I can think of), are:

Creating an XML object for AJAX stuff:

if(window.XMLHttpRequest)
        this.setXMLObject(new XMLHttpRequest());
else if(window.ActiveXObject)
        this.setXMLObject(new ActiveXObject("Microsoft.XMLHTTP"));

Disabling selecting items with mousedown drag:

style="-moz-user-select: none;" onselectstart="javascript:return false;"

(The style is for mozilla, the javascript for IE. Opera doesn't allow this - I presume for the same reasons that it doesn't allow right click scripting actions by default: it's really irritating when things don't do what you expect them to do, or worse still, when people try to stop you "stealing their code/content", especially when it's so trivial to circumvent. FTR, I use this when I want to drag application elements like XML graphs or images/text blocks in content designers etc. without the cosmetic cost.)

Everything else is achieved using the same code and to be honest, it's very rarely that I come across a site that doesn't work in Opera (my personal favourite), but of course there's always the trade-offs (although it could easily be argued that at least the first four of these shouldn't in fact be considered trade-offs, but simply good coding habits):

1. Your markup and scripting needs to be extremely verbose.
2. You need to be very strict with code structure - the order of both elements and tags is very important.
3. You need to develop for all three from the start and a little at a time.
4. Try to keep code as simple as possible, especially with scripting - performance of javascript rendering across browsers is really variable - transforming multiple layers simultaneously for example can give hideous performance (in IE...)
5. To be really compatible, you can't even rely on javascript being enabled - try to write as much as you can server-side to provide at least some kind of basic functionality (as long as you can afford the load).
6. It's often a good idea to use absolute positioning for elements and can be crucial for transforming in Firefox (otherwise in certain circumstances, you can get a nasty flickering effect as though you're lacking a backbuffer). You also need absolute positioning for dragging.
7. Flash???

Legacy compatibility is another question - I mean, how far back should you go in a bid to support users with older software? I tend to test on the current and previous official releases, but make no guarantees for stuff like Netscape and IE4/5 etc. Then again, if you want things like funky interactive AJAX apps, there's only so much as a developer you can do (and to be honest, supporting five-year old software isn't very realistic in a lot of cases).

On a final note, I don't know how difficult it would be to include Konqueror as well but I suppose I consider the Linux guys to be technically savvy enough to get around any HTML rendering problems that they come across (and you're probably using Firefox anyway). I could make excuses that I haven't got the time to setup and play around with a Linux box, but the truth is that I'm both lazy, and indeed far too cozy in my world of Windows, Visual Studio and dare I say, computers that work how I expect them to.

Slashdot Top Deals

It isn't easy being the parent of a six-year-old. However, it's a pretty small price to pay for having somebody around the house who understands computers.

Working...