Browser sniffing/support [split]

Discussion in 'Web Design and Development (archive)' started by pigwin32, Feb 14, 2004.

  1. macrumors regular

    I know this thread is a little old now but I can't let this one slide. I work for a small bank and providing support for different browsers is a nightmare. There are situations where a little browser-specific code is the only solution and therefore a little browser sniffing is required. Either that or identify a fix that isn't going to break in any other browsers. Our information pages are valid xhtml transitional and we're planning to refactor the transactional pages to the same standard. We use a base stylesheet for all browsers and then deliver browser-specific styles based on three broad categories; old; ie; netscape. We don't use css hacks because we don't have to and as a developer I consider css hacks poor practice if it can be avoided. All it does is obfuscate the css which goes against a major tenet of software development, be explicit.

    So give the inept designer crap a rest, judicious use of browser sniffing is a valuable tool when used appropriately.
  2. macrumors 6502a


    except the only browser that I have ever run into trouble using if I follow XHTML and CSS standards is IE. If you code to standards you shouldn't have problems with any browser. So you wouldn't have to worry about supporting different browsers.
  3. Moderator emeritus


    I apologize if you take that "inept designer" comment personally, but you haven't told me anything I haven't already heard.

    Browser sniffing can, and does, do more harm than good to browser/platform compatibility. You're already limiting your options by sniffing for "old, "ie" and "netscape". I'm against CSS hacks, too, and I almost never use them in my designs. But CSS is about presentation, not the actual content and functionality of a site.

    Browser sniffing causes you more work in the long run as you have to keep up with new browsers/versions, and limits the usability of your site by non-standard (PDAs, cell phones, etc.) and non-mainstream (Safari, Firefox, etc.) browsers. To me, it seems like a cop out for not doing adequate browser testing and using valid HTML/CSS.

    Good luck on transitioning to XHTML on your transaction pages and removing the browser sniffing.
  4. macrumors regular

    Without wishing to be rude, this is rubbish. We try to support all browsers back to NN 4.7 and IE 4.01. Standards support just doesn't exist in those browsers simply because there weren't any real standards at that point. They both support CSS 1 to various degrees but not consistently. Similarly there are a variety of bugs in more recent browsers that cause grief, e.g. Opera 7.0. If all browsers had consistent support for standards then your statement would be correct, sadly this is not true now and unlikely to be true in the near future.
  5. Moderator emeritus


    Well, the W3C laid out the recommendation for HTML 3.2 in early 1997 [source]. IE4 came out in late 1997 and Netscape 4.5 in late 1998 [source]. Kinda goes against the whole "there weren't any real standards" concept.

    I agree that browser standard support is spotty, but to me it's one of the catch-22 and/or chicken or egg questions. Standards-based design drives browser standards support. Browser standards support drives standards-based design.

    If we designers do our part then it highlights where browsers are lacking. Modern browsers support web standards well enough to design to spec and then work around idiosyncrasies unique to each browser.
  6. macrumors 601

    Westside guy

    Well, to be honest I've dropped trying to support Netscape 4.7 - it was just too buggy, too proprietary, and too limited. IE 4 did a much better job with basic CSS, although I don't really use that as a low-end either.

    There's really no reason to code for the older browsers, since very few people use them AND there are free newer CSS-compliant browsers available for virtually every platform (in other words, Mozilla variants, Opera, and to a lesser extent IE).

    I do my code development using Mozilla Firebird, er, Firefox. Then I make sure things at least work on IE; browser marketshare dictates that. But I don't use IE hacks - so when I'm working with someone on a site and they're asking why the navigation is semitransparent on my computer but they don't see that effect, it gives me an opening to try "selling" someone else on Mozilla. Mac users generally aren't using IE anymore, so they are for the most part using CSS-compliant browsers already.
  7. Moderator emeritus


    For a good discussion of browser support, I'd suggest people check out mezzoblue's article on the subject from a couple weeks ago.

    It's very concise description of what to support and why.
  8. macrumors regular

    I disagree with you that sniffing does more harm than good. We establish a baseline that all browsers support. That means that our site degrades gracefully for old browsers. Plus the modern browsers that do support standards allow us to deliver a better experience to the users. And going forward all browsers' support for standards will improve, i.e. we don't have to keep up with new browsers/versions because we're already there. I said the information pages of our side validate. And we deliver the same (x)html to every browser, layout is pure css. In addition, if you switch off styles completely our pages still present well because we use structural markup.

    Regarding non-mainstream browsers such as Safari and Firefox, we do our initial development in Firefox (previously Firebird) which is by far the best browser available right now even at version 0.8. We test using Safari and while it's standards support is good it is still a little buggy at version 1.2.

    I'm not advocating rampant browser sniffing to deliver different markup to every browser and limit support to specific browsers. I am advocating the judicious use of sniffing to deliver correct presentation. When done correctly it is blatantly obvious what is happening, not something I could say about css hacks.
  9. Moderator emeritus


    Exactly. So why bother sniffing browsers at all? Let the browser's CSS support what styles it can and can't see using '@import' and screening the CSS.

    That's fine, you're welcome to your opinion. I still say sniffing should be avoided at all costs. There are too many ways it can go wrong (javascript not enabled on client side, misidentifying user agents on server side, etc.) and you end up with browser specific designs. Design once and you're done if you've adequately tested compatibility.

    [edit - No rug pulling here. Just moving things to where they should be. And I already moved your post over. ;) ]
  10. macrumors regular

    Perhaps I could have worded my response better, as you say, support for standards was "spotty" although that is perhaps being a little kind. But working around idiosyncrasies? Aren't we still getting back to hacks/sniffing. Or modifying your design to cater for the lowest common denominator? Certainly in a banking website we can't just write off users of older browsers.
  11. macrumors regular

    Thanks for the pointer. I would love to be able to say goodbye to NN4 and IE4 users but we keep stats on browser usage and we still have a significant number of users that connect with those old browsers. Over time they will slowly disappear/upgrade but meanwhile we're stuck with them.
  12. Moderator emeritus


    I'm not referring to hacks nor to sniffing when I talk about working around idiosyncrasies. You seem to be looking at it as an either (hack) or (sniff) decision. Personally, I design with neither. Design to spec and then test, test, test. You can almost always get around spotty standards support without resorting to hacks.

    And, I should state that I'm not saying that designers who use sniffers should be lined up in front of a firing squad. In some instances, the decision to have a site look a certain way on certain browsers is a decision passed down from the client or a committee that you can't work around. If a sniffer is the only way to achieve that and the client is OK with it, fine. I just think they should be used as a last resort, and not as often as they sometimes are, just for getting around browser differences when there are other ways.
  13. Moderator emeritus


    Playing the devil's advocate:
    Why can't these users get an unstyled page? You said yourself that the pages degrade gracefully thanks to semantic and valid (X)HTML.

    Where is the decision coming from that these users need to see the same exact design as someone on IE6 or Safari?
  14. macrumors regular

    Ok, agreed, testing and tweaking can resolve most issues.

    But the argument against browser sniffing tends to revolve around supporting specific browsers to the exclusion of others and/or the nightmare of supporting new browsers and versions as they are released. I have an expectation that I will need to do very little to support new browsers/versions because they will tend to have improved standards support. So really I'm only sniffing out the old versions and they don't change. As a developer this appeals to me. I know not everyone is able to run server-side script to deliver different stylesheets for different browsers and I can see a use for css hacks in that arena. But I want to make it completely clear to anyone who has to support my work what it is I've done and script allows me to do that.

    Delivering unstyled pages to older browsers really isn't an option, the business/branding wouldn't allow it. We can and do deliver a reasonable facsimile to older browsers. It doesn't contain all the bells and whistles and the business accepts that.

    I should say I think our approach has been a great success. Development time is greatly reduced, the pages are light and download quickly, and the effort required to style the pages is less because we can stop banging our heads against the wall sooner and slot a custom style into the appropriate stylesheet.
  15. Moderator emeritus


    OK, I think we see eye-to-eye on this, more or less.

    You were right to call my earlier comment into question. I was over-generalizing, but it seems almost all "incompatibilities" with new, non-IE browsers really come down to browser-centric design and/or browser sniffing. I'm a little quick to jump to the defense of "the little guy" sometimes. Your situation sounds like a pretty reasonable implementation, even if it's not what I'd do. ;)

    One last point: comments in your CSS file will help to describe any hacks present and what browser they are for. That makes it pretty clear to anyone who supports your work what is going on, too.
  16. macrumors regular

    Fair enough. And comments in css files are definitely worthwhile, especially when a css hack uses comments :rolleyes:

Share This Page