Javascript error: $.browser is undefined

I’ve had to fix a couple of our sites today due to the javascript error “$.browser is undefined”, If you’re using Google’s CDN to deliver your minified jQuery, you may well be seeing the same thing.

It looks like Google has updated their main 1.0 branch of jQuery to serve version 1.9 of the popular javascript library.  Unfortunately some plugins haven’t been updated (or site owners haven’t updated the plugin) to stop using $.browser which is now deprecated.

Fortunately, fixing this is just a case of hardcoding the CDN call to use version 1.8, so in this case change –

http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

to

http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js

And that should fix it.

So far I’ve seen problems with jQuery.autocomplete and jCrop plugins, feel free to add more in the comments.

Advertisements

10 Responses to “Javascript error: $.browser is undefined”

  1. Mark. Says:

    Thanks, this saved my life!, I was having problems with jquery ui tabs and cycle plugin!

  2. maroberto1 Says:

    Reblogged this on XtremeCleanTest.

  3. Jamie Pezone Says:

    Hi I’ve made the changes you suggest here and if i run the function that was causing the problem it now works fine but only the first time, if i run the function again i get the “Javascript error: $.browser is undefined” again

    • osblues Says:

      @Jamie Something must still be calling that (deprecated) function, do you have a publicly accessible URL that I can take a look at?

      • Jamie Pezone Says:

        No unfortunately not, it’s a n intranet site. although I’m using jQuery accordion which seems to be calling it. Do you know on a workaround for this feature by any chance?

      • Jamie Pezone Says:

        OK so i found a fix that seems to work. In jQuery accordion.js file I’m using there is an if statement regarding the safari browser. i deleted this if statement and all is now ok.

      • osblues Says:

        Glad you got it working.. but weird you had to hack it. As long as you’re sure the code is targeting the 1.8 version of jQuery, you *should* be fine.

      • Jamie Pezone Says:

        yeah I know, whats even more strange is I have a live and development version of my system which are identical and follow all the same scripts but this problem is only affecting the live version. Thanks though 🙂

  4. Alex Says:

    Hey!

    You helped me a lot!

    Had some troubles with jQuery.jCrop plugin…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: