Resources

    jQBrowser²

  • jQBrowser²

    jQBrowser²

    This plugin is a combination of 2 different existing plugins/snippets: jQBrowser and Browser Selectors.

    Why combine them? Because I really wanted browser selectors, but the code from Rafael's script isn't really using jQuery (which is a great thing for portability), but I wanted something more inclusive.

    Which takes me to the jQBrowser plugin. It's a great plugin, with a lot of great functionality, BUT, it's breaks jQuery (due to some bad design implementations).
    Since I needed something that does everything both of these pieces do, I first fixed the jQBrowser plugin, and rewrote the browser selector script to use jQuery and the functionality of jQBrowser.

    Functionality
    So, hows it work? Well, the browser selectors are all the same as the original script, with one addition: browser name and version is on all gecko engines. So if you're running Firefox 2, you have an additional selector of .firefox2 (in addition to the existing ones of .opera8, ie6 etc). If you have Netscape 7, the extra selector would be .netscape7.
    With the jQBrowser portion, everything is the same, except that instead of using functions for the browser versions, you use regular properties (just like the original jQuery and Interface, etc).

    But, you still use functions for $.browser.version.number() and $.browser.OS(), and $.browser.win(), etc. (Update: I went ahead and made almost everything into properties instead of functions. The only thing that is still a function is $.browser.version.number() and $.browser.version.string(), everything else is not a function) The ones that are not functions are:

    * $.browser.aol
    * $.browser.camino
    * $.browser.firefox
    * $.browser.flock
    * $.browser.icab
    * $.browser.konqueror
    * $.browser.mozilla
    * $.browser.msie
    * $.browser.netscape
    * $.browser.opera
    * $.browser.OS
    * $.browser.win
    * $.browser.mac
    * $.browser.linux

    In addition, I have fixed the code so that it will work if someone has renamed the $ function (as the Plugin Authoring guide states it should be).

    Also, if you don't want to use the browser selector portion of it, download the uncompressed version and change the variable at the top (var add_selectors = true) to false, and you're good to go. I used Big Dean's javascript packer, so go ahead and repack it if you want to go that route.

    Download
    The plugin is license under the MIT/GPL combo that jQuery is under, and the file linked to above is the compressed version, but you can take a gander at the uncompressed version here:
    jQBrowser² Uncompressed Version (13.56KB)

    jQBrowser² Compressed Version (2.72KB)

Listening to

  • Glen Hansard

    Trying to Pull Myself Away
  • Glen Hansard

    Fallen from the Sky
  • Benzos

    On Your Own
  • Glen Hansard

    Lies
  • Glen Hansard

    Lies