alt text

Caption

Web dev: What browser is visiting the page?

User agent string:

A screenshot of a browser. The URL bar reads firefox://settings, a button on the URL bar is labelled Netscape, a popup from the button reads: “You’re viewing a secure Opera page”, and the web page title reads “Chrome settings”.

  • Maestro
    link
    fedilink
    393 months ago

    It’s called feature detection and it goes a long way back, even before Modernizr popularized it.

    • Gamma
      link
      fedilink
      English
      73 months ago

      Popularized? That gets less than 100k downloads a week

      • @dan@upvote.au
        link
        fedilink
        14
        edit-2
        3 months ago

        Most developers just write their own feature checks (a lot of detections are just a single line of code) or use a library that polyfills the feature if it’s missing.

        The person you’re replying to is right, though. Modernizr popularized this approach. It predates npm, and npm still isn’t their main distribution method, so the npm download numbers don’t mean anything.

        • Gamma
          link
          fedilink
          English
          33 months ago

          Neat, thanks for clarifying! I’ve never heard of it