browser msie error after update to jQuery 1 9 1

0 votes

I use the following snip of a script:

if ($.browser.msie && $.browser.version < 9) {
   extra = "?" + Math.floor(Math.random() * 3000);
}

It works fine with jQuery 1.8.3.

Now I updated jQuery to the new version 1.9.1 to use a new script.
Now I get the following error:

TypeError: Cannot read property 'msie' of undefined

I read the change log of the new jQuery version, but nothing should have changed
with msie

Any known bugs, tips or proposals?

Jun 7, 2022 in JQuery by Edureka
• 13,690 points
1,050 views

1 answer to this question.

0 votes

Since $.browser is deprecated, here is an alternative solution:

/**
 * Returns the version of Internet Explorer or a -1
 * (indicating the use of another browser).
 */
function getInternetExplorerVersion()
{
    var rv = -1; // Return value assumes failure.

    if (navigator.appName == 'Microsoft Internet Explorer')
    {
        var ua = navigator.userAgent;
        var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat( RegExp.$1 );
    }

    return rv;
}

function checkVersion()
{
    var msg = "You're not using Internet Explorer.";
    var ver = getInternetExplorerVersion();

    if ( ver > -1 )
    {
        if ( ver >= 8.0 ) 
            msg = "You're using a recent copy of Internet Explorer."
        else
            msg = "You should upgrade your copy of Internet Explorer.";
    }

    alert( msg );
}
answered Jun 7, 2022 by Edureka
• 13,690 points

Related Questions In JQuery

0 votes
1 answer

JQuery Error: cannot call methods on dialog prior to initialization; attempted to call method 'close'

Hello @kartik, Try this - it works for ...READ MORE

answered May 29, 2020 in JQuery by Niroj
• 82,840 points
2,018 views
0 votes
1 answer

How to refresh a jQuery UI Slider after setting min or max values?

Hello @kartik, You should try doing something like ...READ MORE

answered May 30, 2020 in JQuery by Niroj
• 82,840 points
5,562 views
0 votes
1 answer

Best cross-browser method to capture CTRL+S with JQuery?

$(window).keypress(function(event) { if ...READ MORE

answered May 30, 2022 in JQuery by gaurav
• 23,260 points
1,563 views
0 votes
1 answer

How to call $(window).on("load", function) in jQuery-3.3.1?

Use $(document).ready() instead of $(window).on("load", function... $(document).ready(function() { ...READ MORE

answered Jun 21, 2022 in JQuery by rajatha
• 7,680 points
3,674 views
0 votes
2 answers

Difference between Hadoop 1 and 2

Hadoop V.1.x Components Apache Hadoop V.1.x has the ...READ MORE

answered Aug 28, 2018 in Big Data Hadoop by zombie
• 3,790 points
19,817 views
0 votes
1 answer

How to check the version of Python?

you can check the version of python ...READ MORE

answered Sep 25, 2018 in Python by SDeb
• 13,300 points
795 views
0 votes
1 answer

How to use jquery with asp.net ajax?

If you weren't aware, Microsoft is planning ...READ MORE

answered Oct 15, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
747 views
+1 vote
1 answer

How to find out which version of R is loaded

You can use sessionInfo() to accomplish that. > sessionInfo() R version ...READ MORE

answered Nov 8, 2018 in Data Analytics by Maverick
• 10,840 points
718 views
0 votes
1 answer

How to change color of SVG image using CSS (jQuery SVG image replacement)?

Edit your SVG file, add fill="currentColor" to ...READ MORE

answered Jun 1, 2022 in JQuery by Edureka
• 13,690 points
22,153 views
0 votes
1 answer

How to add class using jQuery?

Add a class name to the first ...READ MORE

answered Jun 1, 2022 in JQuery by Edureka
• 13,690 points
3,192 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP