In the few year that I have been working with web applications I periodically come across someone else's code that explicitly checks for specific browsers (IE versus Netscape, for example) and then takes different actions depending on the user's browser. I understand that they do this because they are using features of one browser that may not be supported by others, but my question is why would any one use browser brand specific features in the first place? In my experience I haven't seen a business requirement that couldn't be handled by sticking with the HTML, CSS and browser scripting standards established by the World Wide Web Consortium. Since it is reasonable to expect that any browser that wants to be mainstream would support these standards, I don't understand why anyone wouldn't adhere to them. I am intersted in hearing about anyone elses experience with regard to this. Have I just been lucky that I have had business requirements that haven't forced me outside the standards? Are there valid reasons for coding to specific browsers? If so, what ar some examples? Thanks in advance for your insight.
While I try as much as possible to keep any client-side code browser-agnostic, there are times when you need to diverge. This is mostly because the majority of the world uses IE on Windows and Micro-"we don't need no stinking standards"-soft hasn't seen fit to follow the W3C standards that the other browsers are following. And I'll be damned if I'm going to code just for IE. Simple business requirements probably can be satisfied by a least-common-demoninator approach, but some advanced web apps that I've worked on (present projects included) need a bit more smarts on the client side. So I'm forced to browser-specific code (especially in the area of advanced event handling) so that the apps will work both on IE and on standards-conforming browsers. [ February 13, 2004: Message edited by: Bear Bibeault ]
IE has many neato features that other browser do not have... Not all browsers follow standards compliance to a T. A lot of the "brand specifics" can get a user around having to use a server side language. With IE, a person can do a database call with Active X and does not require ASP,JSP,PHP etc. But most companies only care about IE since their employees are required to use that browser. When I get more time I will put some more beef into the answer. Eric
Joined: Feb 11, 2003
But most companies only care about IE since their employees are required to use that browser.
I guess that's fine if you are developing an application that is intended for use by a pre-set population where you (or someone) controls the browser choice. However, applications that are intended for public (World Wide Web) use can't depend on a certain browser (or for that matter that the user agent will even be a visual browser?), so it seems to me that you should stick with standard HTML and scripting on the client side unless there is an overwelming business need that makes it worth excluding certain segments of the potential users. That's why I am perplexed that so many web app developers seem to disregard standard solutions so readily.
Joined: Nov 08, 2001
Where in the world are you getting this information or scripts or this idea? I post in multiple forums and everyine works to get their browsers compliant with all browsers. There is such old scripts on certain sites that show up in google that were designed back in gen. 3/4 days and do not work..... If you are saying that the code has to work in Netscape 4.X then you need to realize that the world is not considering that browser dead since the technology today is way past that. You can find that on all of the main sites. Eric
That's why I am perplexed that so many web app developers seem to disregard standard solutions so readily.
I think Eric made a good point that a lot of what you may be seeing is older code simply lifted from older web apps or sites that the "author" put into his/her site without understanding any of it. Also, I'll reiterate one of my my points: while standards-compliance is a wonderful thing -- and it's a drum I beat more loudly than almost anyone else I know -- at this point in the game, it's simply not possible for some advanced requirements (event handling being my poster-child example) until IE complies with the way other browsers are working. I'm sure Eric could write a tome on how event handling differs between browser implementations...
Just to add some reason - here is some statistics from my website for last year. Standards is a nice thing, but IE or NN available for free... Not all programs works in all operating systems, browser is just a next layer - it depends only on how do you define your requirements Browsers Unique Visitors
Looking at priority of things to do, I would rather do something for IE users (95%) then for NN 3, or 7. So, if something is can be done for IE only, I would do it without second thoughts. I think it better, than having some works everywhere common denominator. And if there are some things, that easy to do for IE, but requre some effort for verything else - I would do it for IE first, and think about everything else later. And probably will do it only for NN7.1 and IE5.5+ (even though NN3 has higher rating ).
While making things work out for IE is usually a must -- since that's what most people will hit the site with -- I disagree that it's not equally important to support the browsers that conform to W3C standards; even if they are currently a small part of the market. These browsers will never have a chance against IE if sites force people to use IE. So for me, it's well worth the extra time it takes to make my pages work both for browsers that follow W3C standards, and the non-standard IE. And in case anyone might ask "why do we need browsers other than IE?", my answer is simply that IE isn't really a very good browser with regards to CSS implementation and other web standards that are becoming more and more important. [ February 16, 2004: Message edited by: Bear Bibeault ]
Joined: Feb 11, 2003
Thanks for all your replies. You've provided some good insight into why and when it may be necessary to deviate from the W3C standards.