I use a media query to load in a stylesheet (if device is a tablet).
I was just wondering how I could check in my javascript if the user is using a tablet, is there a check or should I just check what stylesheet was loaded in?
I use a media query to load in a stylesheet (if device is a tablet).
I was just wondering how I could check in my javascript if the user is using a tablet, is there a check or should I just check what stylesheet was loaded in?
Try to see if perhaps this sheds a light on your question:
What is the best way to detect a mobile device in jQuery?
As the answer to that thread says, I'd suggest to rely on 'feature detection' rather than tablet vs non-tablet (as it may not be as straightforward as one may think) hence --> http://modernizr.com/
Try passing the useragent from the server into the page so that JavaScript knows exactly what browser is being reported.
You can use navigator.userAgent and do a substring search to find out which tablet viewing your site. Here is a current list of tablet userAgent http://mojosunite.com/tablet-user-agent-strings