Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5967121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:53:54+00:00 2026-05-22T19:53:54+00:00

What is the means, benefit and differences between User Agent detection and Feature Detection?

  • 0

What is the means, benefit and differences between User Agent detection and Feature Detection? and which one is better?

And please give usages examples for both.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:53:54+00:00Added an answer on May 22, 2026 at 7:53 pm

    The main reason to use feature detection as opposed to user agent sniffing is future proofing.

    Let’s say, for example, that you want to use some new XMLHttpRequest 2.0 features (just making this up). You know IE doesn’t support it but Firefox does, and so you have code like this in your JS:

    if (!IE) {
        UseNewAjax();
    } else {
        UseOldAjax();
    }
    

    Later, a new version of IE comes out which supports the new features, but because you are agent-sniffing, your IE viewers can’t get this feature goodness without you making a change to your code.

    On the other hand, if you feature detection:

    if (document.hasCoolNewAjax) {
        UseNewAjax();
    } else {
        UseOldAjax();
    }
    

    You can be assured in the future that if a browser supports a feature they didn’t before, they can start using these features immediately, and you don’t have to change your code to support it.

    Browser / User Agent sniffing: Using a programming language to determine what browser a visitor is using, so special logic can be written against that browser. Inefficient and considered a bad practice in the development community.

    Feature detection: Using a programming language to determine whether a browser supports a particular feature. Considered a best practice in the developer community because it is fool-proof and future-proof.

    From Wikipedia:

    User agent sniffing is mostly considered poor practice, since it encourages browser-specific design and penalizes new browsers with unrecognized user agent identifications. Instead, the W3C recommends creating HTML markup that is standard,[citation needed] allowing correct rendering in as many browsers as possible, and to test for specific browser features rather than particular browser versions or brands.

    JavaScript isn’t the only language which you can user-agent sniff or feature detect from. For example, the .NET framework has properties that let you read all sorts of information about the browser:

    http://msdn.microsoft.com/en-us/library/3yekbd5b.aspx

    http://modernizr.com

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there some means of querying the system tables to establish which tables are
I'm by no means a sysadmin so please correct me if I'm wrong. I
I'm looking for (simple) examples of problems for which JMS is a good solution,
It seems there is very few comparison between Selenium / WatiN and SimpleTest (which
LINQ uses a Deferred Execution model which means that resulting sequence is not returned
means, do sth, then request using jQuery, like a hooker. How can i do
By means of a regular expression and Greasemonkey I have an array of results
NSData means what? how to implements its characterstics in java?
I means copying individual MyISAM table files is: (shut down mysqld and copy the
Protected Means, we can access this member only in a deriving class, and internal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.