views:

33

answers:

1

I noticed that some wordpress themes ('Thematic' for example) adds user specific classes to the body element so you don't have to retort to CSS browser hacks, for example:

wordpress y2010 m02 d26 h05 home singular slug-home page pageid-94 page-author-admin page-comments-open page-pings-open page-template page-template-home-php mac firefox ff3

So it automatically figured out the day, month, year, os, browser and browser version besides several other wordpress specific details and added them as classes to the body. Is it possible to do the same using jQuery only (no PHP) on static pages?

Thanks!

A: 

You could set an onload event on the body tag that calls a function that does something like this:

if($.browser.safari){
    $('body').addClass("safari");
 }​

These links might help:

Ronald
Possible to also get os and day date info?
Nimbuz
I don't think JQuery comes with a way to detect the OS. There might be a plug-in to do that. You should check out PPK's detection object it might be better for what you want to do: http://www.quirksmode.org/js/detect.htmlYou can pull the date from Javascript Date object.
Ronald