Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
like image 727
Upland Avatar asked Jan 24 '13 23:01

Upland


3 Answers

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.

like image 130
JFK Avatar answered Nov 15 '22 11:11

JFK


I prefer this one to target a range, will run code only on < IE9 & jQuery 1.9+

if (/msie [1-8]./.test(navigator.userAgent.toLowerCase()))
{
    //code here
}
like image 42
Shazbot Avatar answered Nov 15 '22 11:11

Shazbot


Ever since Jquery deprecated the $.browser funcionality the easiest way that i found, was to create a global in javascript

var LTE_IE9 = false;

and the in use the condition HTML IE selectors

<!--[if lte IE 9]>
<script>LTE_IE9 = true;</script>
<![endif]-->
like image 2
Kup Avatar answered Nov 15 '22 12:11

Kup