Posted by anthonyvz on January 27, 2009 at 2:50pm
Hey Everyone,
Here's the jQuery to detect browser version. This one would look for Internet Explorer 6 and add a css style to "SOME-UNIQUE-ID"
if (jQuery.browser.msie) {
if(parseInt(jQuery.browser.version) == 6) {
$('#SOME-UNIQUE-ID').css('property','value');
}
}
It will detect;
* safari
* opera
* msie
* mozilla
Hopefully you can put that to use. I'm in the process of trying to get it to detect if the user is on an iPhone or not.
Cheers,
Anthony
Comments
just be careful, people that
just be careful, people that use ie6 don't necessarily have javascript enabled. suckers for punishment...
when's our next meeting?
gav
Oh god how did this get in here I am not good with computers
True, but...
I'd be surprised if there are many people out there without JS turned on, since I know a lot of sites require it. All the Yahoo sites pretty much require JS, for instance. But it is a good point, we should always try to build sites that degrade gracefully for those without JS.
As for the next meeting, the plan is for the third Wednesday, which would be Feb 18.
jQuery detect iphone
You can also detect if your site is being visited on iphone.
Here we go detecting iPhone with jQuery:
function isiPhone(){return (
(navigator.platform.indexOf("iPhone") != -1) ||
(navigator.platform.indexOf("iPod") != -1)
);
}
if(isiPhone()){
// Iphone users :))
}
jQuery Howto
I'm sorry uzbekjon, i try
I'm sorry uzbekjon, i try your tips and it doesn't work for me. Are you sure about the syntax ?
Best regards
Popoox
Myqaa