Search code examples
jqueryimpromptu

Impromptu .. with jquery 1.9 - error with browser.msie


I get an error with impromptu ver 4.1 when running under the latest jquery 1.9

Uncaught TypeError: Cannot read property 'msie' of undefined

This was not the case with previous versions of jquery.

The offending line in impromptu is line 20:

var ie6 = ($.browser.msie && $.browser.version < 7);

Solution

  • You could patch Impromptu replacing this line :

    var ie6 = ($.browser.msie && $.browser.version < 7);
    

    ... by this one :

    var ie6 = ( navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/6/) );
    

    ... so now it can work with jQuery v1.9.0+. Optionally, you could rollback to jQuery v1.8.3

    EDIT (March 12th, 2013)

    Thanks @johntrepreneur for your comments, you are correct. Two notes:

    1. This edited line :

      var ie6 = ( navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/6/) );
      

      ... should be replaced by this one :

      var ie6 = ( navigator.userAgent.match(/msie [6]/i) );
      

      ... my bad, I rushed writing the patch. That should do the trick.

    2. Impromptu has completely removed IE6 support in their last commit (on March 25/2013 after this original post). The issue brought by the OP was that Impromptu did break with jQuery v1.9+ ... updating the Impromptu js file to the last version does also fix the issue.