I'm building a small application to determine if your browser is current. I've found ways in PHP and javascript to get the user agent but i'm looking for some sort of API or service to get a response if your browser is the newest version.
-
I don't think you can actually do it.Peon– Peon2012年07月21日 22:07:57 +00:00Commented Jul 21, 2012 at 22:07
-
4I think you'd have to maintain the of latest browser versions manually.jwatts1980– jwatts19802012年07月21日 22:31:28 +00:00Commented Jul 21, 2012 at 22:31
-
1I agree, manualy keeping info about the latest browsers versions and then comparing it to the user browser. Although creating such version repository and keeping it up to date may not be an easy task.Grzegorz Kaczan– Grzegorz Kaczan2012年07月21日 23:25:11 +00:00Commented Jul 21, 2012 at 23:25
-
3I would recommend that you look for browser features rather than to look at browser versions. This way your app runs with fallbacks in mind. You can use modernizr to help with that.Sal Rahman– Sal Rahman2012年07月22日 00:52:48 +00:00Commented Jul 22, 2012 at 0:52
-
You could try using something like WURFL but I strongly suggest that you consider @skizeey's comment. It's much easier once you get the hang of it.Roberto– Roberto2012年07月22日 01:45:27 +00:00Commented Jul 22, 2012 at 1:45
1 Answer 1
You could keep an APC (or file or whatever) cache of the latest browser versions updated via a weekly or daily cron job which scrapes the latest version numbers from the various websites. Then you could create a PHP script which utilizes that cache and compares it to a useragent to return whether or not the browser is current.
Having said that, the far more useful and sustainable approach is to determine which features you need and then use modernizr, which is literally one of the most useful JS libraries you can use to ensure compatibility. If you check out the download page, you can see which features you can detect using the script and thus you can tailor your website appropriately.