in IE9 The command $_SERVER['HTTP_USER_AGENT']
in php returns only the short UA string
and in JavaScript I can get the extended UserAgent with navigator.userAgent
property
Is there a way to get the full extended UserAgent in PHP from IE9?
the 开发者_开发百科purpose is to get the strings i have put in the regitry: HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform the extended UserAgent contain the strings from regitry.
Introducing IE9’s User Agent String
The difference between JavaScript and PHP implementations of getuserAgent()
function is - JavaScript communicates with browser itself while PHP knowns only data sent earlier by browser to server.
There is function get_browser()
in PHP (since PHP 4) which can give you most information from data available to server: http://www.php.net/manual/ru/function.get-browser.php. Beware that this function relies on browscap.ini which is not bundled in PHP and should be updated and installed manually.
Anyway there are no extended information about user's browser available on server side.
I don't think it gets sent with the headers, only way would be to access
navigator.userAgent
with javascript and push it to your server with AJAX.
EDIT
Or, use PHP's getallheaders() function to check all the headers sent with a request.
In the link that you posted by yourself, Introducing IE9's User Agent String, it says:
IE9 will send the short UA string by default
The server doesn't recieve the long User Agent String. The only solution I can think of, is to post with AJAX, but that really is safe. People can just turn of their javascript.
精彩评论