0

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?

amateur
  • 41,925
  • 62
  • 185
  • 308
  • 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 Answers2

2

You can just set $.browser.isPngSupported to true or false.

However, you should be extending $.support, not $.browser.

SLaks
  • 837,282
  • 173
  • 1,862
  • 1,933
  • +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,889
  • 2
  • 23
  • 34