Best Open Source WURFL alternative [closed]

心已入冬 提交于 2019-11-29 22:57:54

Any reason not to use the ua-parser project?

The PHP client is here: https://github.com/tobie/ua-parser/tree/master/php

Sorry to revive a dead post but there is an Open Source Alternative - OpenDDR - but I can't find PHP libraries for it yet so you will need to code your own parse and search routines.

I use a script based on the work at http://detectmobilebrowsers.com/. It boils down to a regular expression, which is supported in pretty much any language, not just PHP. As regex's go, it's not even terribly ugly: the main one is only a few lines long, and would be extremely quick to parse in most languages/frameworks. Being a regex, it's totally transparent, and doesn't require you to install some librarly, DLL, or DB/file-based repository.

The author, Chad Smith, uses the WURFL database to compile a stripped-down, minimalist Regex to detect only mobile browsers. Tablets are excluded on the assumption that they will usually work well with the desktop version of a page. He seems to update it once a year, or at least whenever a new major mobile browser comes out (which is not very often.)

It's easy to add Tablet browser detect to Chad Smith's regex's, and it seems to work well. See the about section:

http://detectmobilebrowsers.com/about

I use MobileESP which is not as advanced as WURFL, but does the trick for my needs. There is no separate database in MobileESP that you can upgrade, you have to upgrade the whole library.

If you only need device categorisation - e.g. mobile, desktop or tablet - then Categorizr is probably the best option. It takes a mobile first approach as it is easier to identify the small and relatively stable population of desktop browsers than the vast number of mobile and other browsers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!