Because windows xp renders certain fonts so poorly, i would like to detect whether the user is using that OS and add a class to the body accordingly.
I'm looking ideally for an html conditional statement or php $_SERVER var to do this
However failing that a piece of javscript along the lines of below would do
if(users_os === 'xp'){
$('body').addClass('xp');
}
What avenues should i be persuing?!!!
thanks!
EDIT: TO CLARIFY!
This is further development on a project which renders the webapp in nicer fonts if the user has it natively installed - see part of my solution here: for extending font stacks abilities.
Fonts render differently on combinations of OS and Browser, not Browser alone - i want to be able to know whether a user is on xp or not becuase it's rendering of Calibri is so very poor
It actually makes no sense to determine which operating system
is used for a Web Application. The only thing which should be of interest, is the Browser
. Even in the Browser you just have to care about what it supports and what not.
In JQuery you may use the .support(), .browser() and .boxModel() methods for that purpose.
I fully agree with jAndy's answer, you shouldn't ever need OS detection for a web application and you should rarely need browser detection (the exception being stats/analytics, of course).
That being said, if you're insistent you need this, you can get what you need to know using the PHP function get_browser()
:
$browser = get_browser();
echo $browser["platform"];
// -> "WinXP"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With