Should I use userAgent or appVersion to track visiting browsers to my website?
As web browsing continues to change due to apps with "web view" widgets, tablets, etc., I want to track hits to my website based on browser-type so I can proactively tailor content and presentation.
When I examine a small handful of web browsers from iPad, Android, Macbook, iPad and others, it appears that 开发者_如何学JAVAthe userAgent is simply the appCodeName concatenated with appVersion.
Is that always true? Can I rely on it for presentation (i.e., CSS) decisions?
Any other issues to consider?
I think it's better to use a browser detection mechanism like WURFL(Wireless Universal Resource File). This is an XML file (and now a DB file) and various DBI libraries that not only contain up-to-date wireless user-agent data, but also what features and capabilities those user-agents support.
And Detect Mobile Browser that do this in Apache, ASP, ColdFusion, JavaScript and PHP.
精彩评论