title: How to make a jquery plugin, which is written by someone else, work in all the browers it could actually work?
body: <p>How do I use feature detection to make a <strong>plugin</strong>, which was written by someone else, to work on all those browsers where it could actually work/is supported. The <strong>plugin</strong>'s documentation says it is supported in IE 8 but it doesn't actually work. I know it is because of the unreliable browser detection but what can I do to make it work in all those browsers where it could actually work?</p>
  
  <p><strong>Details</strong>  </p>
  
  <p>Just to give a particular example, I am using jQuery chosen plugin version 0.9.7 and as the documentation says - </p>
  
  <blockquote>
    <p>All modern browsers are supported (Firefox, Chrome, Safari and IE9).
    Legacy support for IE8 is also enabled.</p>
  </blockquote>
  
  <p>However, I found that it does not work in many IE 8s but works on IE tester IE 8. Then inside the plugin code I found this browser detection logic which simply escapes out of the plugin logic  - </p>
  
  <pre><code>if ($.browser.msie &amp;&amp; ($.browser.version === "6.0" || $.browser.version === "7.0")) {
     return this;
  }
  </code></pre>
  
  <p>And I found that <code>$.browser.version</code> was returning 7.0 on my IE 8 and that's why it was not working. Well, nothing to be surprised of, I know. I tried removing the <code>$.browser.version === "7.0"</code> condition, just to check if it actually works on my IE 8 and it worked. But, I cannot remove that condition since the author of the plugin has done that and he must be knowing better.</p>
  
  <p>Now, my question is how do I use feature detection to make it work on all those browsers it can actually work. I guess the logical step would be to find out which all browser features are used by this plugin. Then how do I find that out? Please pardon my limited knowledge regarding this. I just have theoretical knowledge of feature detection, how it is better than browser detection etc. but never actually used any code which does feature detection. I learned about this some 1-2 years ago.</p>
  
  <p>And this time when I searched, I came to know about <a href="http://www.modernizr.com/" rel="nofollow noreferrer">Modernizer</a>. Could this be helpful? I am not sure because it says it for building the next generation of HTML5 and CSS3-powered websites and we don't use HTML5, CSS3 much yet. Or is <a href="http://api.jquery.com/jQuery.support/" rel="nofollow noreferrer">jQuery.support</a> enough for me once I know which all features are needed by the plugin.</p>
  
  <p><strong>Some further Reasoning</strong>  </p>
  
  <p>I found this question <a href="https://stackoverflow.com/questions/6528457/browser-detection-via-object-feature-detection">Browser detection via object/feature detection</a> where the author asks whether it is possible to use feature detection to figure out what the browser actually is. One comment says - "The whole point of feature detection is so that you can find out whether the browser actually has the features you need. When you do that right, you don't actually care what browser it is, you just care whether it has the feature you need to do your job." I understand and agree to this, but then what is the point in saying that a given plugin is supported in these browsers. Why don't plugin authors list out all the features that are needed, thereby making it easy for people to use? But, then it looks for me like the point behind listing the supported browsers is just giving an idea of the compatibility by assuming <em>ideal browsers</em>. </p>
  
  <p>e.g., two ideal IE 6 browsers will have the same select drop-down z-index issue interfering with popup divs. Suppose, a plugin has issues with this, then saying this plugin is not compatible with IE 6 means an ideal IE 6 browser and not another IE 8 browser whose user agent is tempered with and which returns IE 6 as the browser version.</p>
  
  <p>In that case (point behind listing the supported browsers is just giving an idea of the compatibility by assuming <em>ideal browsers</em>), does it make sense to identify browsers using feature detection? If, so why aren't there much example snippets available?</p>
  
  <p>Lots of questions.. :) I guess, today I asked it all...</p>