开发者

How reliable is php function get_browser?

开发者 https://www.devze.com 2023-03-14 08:36 出处:网络
I am trying to find a good way to detect a visitor OS, browser, etc. I found the PHP function get_browser

I am trying to find a good way to detect a visitor OS, browser, etc.

I found the PHP function get_browser

And I see that function can detect Java, 开发者_JAVA技巧I though the function used the user agent for detection, and I don't see any mention to Java on my VMs ua with java installed.

How does the function knows?


It's as accurate as your browscap.ini file is. The file isn't bundled with PHP so it's up to you to keep it up-to-date. You can get it from http://browsers.garykeith.com/downloads.asp.

Notice: The values contained in the array are based on the "technical capabilities" of the browser and do not account for features that were disabled by the user (i.e. the user may have disabled JavaScript).


It is not reliable. It only tells you what the browser might support if it had the feature enabled.

Not to mention, the user agent can be spoofed.

0

精彩评论

暂无评论...
验证码 换一张
取 消