[jQuery] Re: What can we use in place of $.browser?
I thought this as well, $.browser still works, as many plugins use it, but I'm interested in what we should be using. fambi wrote: Having just upgraded to 1.3.2, I've realised that the $.browser utility has been deprecated. Does this mean it is no longer possible to identify which browser is being used?
[jQuery] Re: What can we use in place of $.browser?
http://docs.jquery.com/Utilities/jQuery.support jQuery now uses feature detection. There are some good links to explain in the post above. It is still possible to detect which browser is being used (plain old js) but jQuery support will probably be removed at some point in the future. On Wed, Feb 25, 2009 at 5:23 AM, Liam Potter radioactiv...@gmail.com wrote: I thought this as well, $.browser still works, as many plugins use it, but I'm interested in what we should be using. fambi wrote: Having just upgraded to 1.3.2, I've realised that the $.browser utility has been deprecated. Does this mean it is no longer possible to identify which browser is being used?
[jQuery] Re: What can we use in place of $.browser?
ok, lets say I wanted to target IE6 only, how would I do that with support? Aaron Gundel wrote: http://docs.jquery.com/Utilities/jQuery.support jQuery now uses feature detection. There are some good links to explain in the post above. It is still possible to detect which browser is being used (plain old js) but jQuery support will probably be removed at some point in the future. On Wed, Feb 25, 2009 at 5:23 AM, Liam Potter radioactiv...@gmail.com wrote: I thought this as well, $.browser still works, as many plugins use it, but I'm interested in what we should be using. fambi wrote: Having just upgraded to 1.3.2, I've realised that the $.browser utility has been deprecated. Does this mean it is no longer possible to identify which browser is being used?
[jQuery] Re: What can we use in place of $.browser?
You would need to find whatever quirk it is you are targeting and create a function or otherwise create a scenario where that quirk is exposed, and use that to populate some identifier. eg: jQuery detects support.opacity by creating a div style=opacity:0.5 and then later testing the opacity value or lack thereof. I find it cumbersome, actually. My most recent example was position:fixed. I know only IE6 can't handle this in any way shape or form, but would have to some dom creation and calculation to find out if the current browser supports position:fixed. Fortunately, I know IE6 is the only one serving FAIL on position:fixed, so I just check the UA. On Wed, Feb 25, 2009 at 11:10 AM, Liam Potter radioactiv...@gmail.com wrote: ok, lets say I wanted to target IE6 only, how would I do that with support? Aaron Gundel wrote: http://docs.jquery.com/Utilities/jQuery.support jQuery now uses feature detection. There are some good links to explain in the post above. It is still possible to detect which browser is being used (plain old js) but jQuery support will probably be removed at some point in the future. On Wed, Feb 25, 2009 at 5:23 AM, Liam Potter radioactiv...@gmail.com wrote: I thought this as well, $.browser still works, as many plugins use it, but I'm interested in what we should be using. fambi wrote: Having just upgraded to 1.3.2, I've realised that the $.browser utility has been deprecated. Does this mean it is no longer possible to identify which browser is being used?
[jQuery] Re: What can we use in place of $.browser?
Its better to detect features not browsers; that said detecting a single browser such as ie6 I would use conditional comments feeling assured that the code is not interfering with other bits http://www.sitepoint.com/forums/showthread.php?t=455334 2009/2/25 Liam Potter radioactiv...@gmail.com ok, lets say I wanted to target IE6 only, how would I do that with support? Aaron Gundel wrote: http://docs.jquery.com/Utilities/jQuery.support jQuery now uses feature detection. There are some good links to explain in the post above. It is still possible to detect which browser is being used (plain old js) but jQuery support will probably be removed at some point in the future. On Wed, Feb 25, 2009 at 5:23 AM, Liam Potter radioactiv...@gmail.com wrote: I thought this as well, $.browser still works, as many plugins use it, but I'm interested in what we should be using. fambi wrote: Having just upgraded to 1.3.2, I've realised that the $.browser utility has been deprecated. Does this mean it is no longer possible to identify which browser is being used?
[jQuery] Re: What can we use in place of $.browser?
On Wed, Feb 25, 2009 at 11:19 AM, Sam Sherlock sam.sherl...@gmail.com wrote: Its better to detect features not browsers; that said detecting a single browser such as ie6 I would use conditional comments feeling assured that the code is not interfering with other bits http://www.sitepoint.com/forums/showthread.php?t=455334 Conditional Comments are great and all (best thing to come from MS since asynchronous requests) but they're not the best solution here, IMHO. Whether it's the browser or a feature that needs detecting, it's often required somewhere in the middle of some routine. Using CC, you'd need to duplicate your method, object, whatever.
[jQuery] Re: What can we use in place of $.browser?
Then we probably need a plugin for this. Because browser detection can also be used for information (not only development).
[jQuery] Re: What can we use in place of $.browser?
According to John Resig $.browser will remain for the foreseeable future. Being deprecated doesn't mean it will be removed soon (or at all). If you're targeting IE6 quirks I'd think it's not that bad to keep using browser detection, but if you're using it to differentiate modern browsers it's better to switch to feature detection to make your code future-proof. - ricardo On Feb 25, 2:00 pm, jerone jeron...@gmail.com wrote: Then we probably need a plugin for this. Because browser detection can also be used for information (not only development).
[jQuery] Re: What can we use in place of $.browser?
On Feb 25, 11:59 am, brian bally.z...@gmail.com wrote: Conditional Comments are great and all (best thing to come from MS since asynchronous requests) but they're not the best solution here, IMHO. Whether it's the browser or a feature that needs detecting, it's often required somewhere in the middle of some routine. Using CC, you'd need to duplicate your method, object, whatever. That's not true. I do things like this: // This is a better check than looking at userAgent! useIframe:/*...@cc_on @*//*...@if (@_win32) true, @else @*/false,/*...@end @*/ Anyone who thinks they have a need to check the browser would benefit from reading more about feature detection and why it is almost always a better strategy. It just doesn't come naturally at first for many, and you might struggle through some yeah, BUT! moments, but in the end you'll be better off. Matt Kruse
[jQuery] Re: What can we use in place of $.browser?
On Wed, Feb 25, 2009 at 2:26 PM, Matt Kruse m...@thekrusefamily.com wrote: On Feb 25, 11:59 am, brian bally.z...@gmail.com wrote: Conditional Comments are great and all (best thing to come from MS since asynchronous requests) but they're not the best solution here, IMHO. Whether it's the browser or a feature that needs detecting, it's often required somewhere in the middle of some routine. Using CC, you'd need to duplicate your method, object, whatever. That's not true. I do things like this: // This is a better check than looking at userAgent! useIframe:/*...@cc_on @*//*...@if (@_win32) true, @else @*/false,/*...@end @*/ I stand corrected. I forgot about using them that way. I generally only use them for CSS because I like to keep MS-specific stuff in its own file. Anyone who thinks they have a need to check the browser would benefit from reading more about feature detection and why it is almost always a better strategy. It just doesn't come naturally at first for many, and you might struggle through some yeah, BUT! moments, but in the end you'll be better off. Just to clarify, I have no problems with using feature, rather than browser, detection. I do think this is a smart move.