File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Targeting specific browsers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Targeting specific browsers" Watch "Targeting specific browsers" New topic
Author

Targeting specific browsers

Greg Reinl
Ranch Hand

Joined: Feb 11, 2003
Posts: 45
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

There's really no JSP dimension to this topic, so I'm moving it off to the HTML/Javascript forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

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 ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
Greg Reinl
Ranch Hand

Joined: Feb 11, 2003
Posts: 45
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.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

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...
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
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

MSIE 6 5180 65.01%

MSIE 5 2420 30.37%

Netscape 3 176 2.20%

Netscape 7 83 1.04%

MSIE 4 41 0.51%

Other 23 0.28%

Netscape 4 17 0.21%

Opera 6 16 0.20%

MSIE 3 5 0.06%

Opera 5 3 0.03%

Netscape 2 2 0.02%

AOL 4 1 0.01%
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

What's your point?
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
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 ).
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

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 ]
Greg Reinl
Ranch Hand

Joined: Feb 11, 2003
Posts: 45
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Targeting specific browsers
 
Similar Threads
Looking for Book Suggestions
Mozilla vs Opera
How problematic you web experts see IE as a browser
Thousands of Java Jobs Available!
Professional Java E-Commerce by Subrahmanyam Allamaraju, et al (Wrox)