Home » Php » php – Detect Browsers older than two years

php – Detect Browsers older than two years

Posted by: admin July 12, 2020 Leave a comment


This is for a private company site with about 10,000 users.

I’ve seen a couple of efforts for browser detection but nothing with the age of the browser, does anyone have an idea for this?

Related Projects:

So far I was thinking client side but if there are any server side options I’m open to that as well.

not looking to scrape sites.

They are looking to upgrade browsers and currently want to drop support for browsers older than two year

How to&Answers:

You’re going about it all the wrong way. You don’t support browsers, you support features. Browsers don’t expire like a can of beans would in your pantry. Use feature detection and polyfills when developing – this will retroactively provide support to browsers 10 years old.

Various tools exist to help you support browsers that may be lacking in the feature department. One popular one is Modernizr. Not only does this expose an object that tells you over 40 different things about what the user agent is capable of, it also polyfills a subset of HTML5 tags, and attaches informative CSS classnames to your document that let you style against browsers that support or don’t support any given feature.

Using great practices like this will ultimately result in a better experience for your clients, improved reputation for your employer, and less frustration for you having to try and figure out some magical expression for determining the antiquity of a faceless browser by some mutable user agent string.


Firefox includes a build date in it’s User Agent string, but I’m not sure if other browsers do that. I think your best bet will be to use a white list approach rather than trying to black list an unknown number of browsers. Here are a few sites that can help you warn users when their browser isn’t on your white list.