I want to write some jquery that will extend $.browser with some of my own properties. So it I can currently access $.browser.msie, how could I extend it to include $.browser.isPngSupported etc?
Asked
Active
Viewed 160 times
0
-
possible duplicate of [Is it possible to check for PNG support with jQuery.Support?](http://stackoverflow.com/questions/896014/is-it-possible-to-check-for-png-support-with-jquery-support) – lonesomeday Jun 06 '11 at 22:27
2 Answers
2
You can just set $.browser.isPngSupported
to true
or false
.
However, you should be extending $.support
, not $.browser
.

SLaks
- 868,454
- 176
- 1,908
- 1,964
-
+1 for emphasizing preference for $.support. Just to add a bit, [jQuery.com has this to say](http://api.jquery.com/jQuery.browser/): "We recommend against using [$.browser]; please try to use feature detection instead (see jQuery.support). jQuery.browser may be moved to a plugin in a future release of jQuery." – brymck Jun 06 '11 at 23:09
0
var newData = { 'isPngSupported': true,
'more': 'x',
'evenMore': 'y' };
$.browser = $.extend( true, $.browser, newData );

KOGI
- 3,959
- 2
- 24
- 36