Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Uncaught TypeError: Cannot read property 'msie' of undefined #26

Open
vanduc1102 opened this issue May 31, 2015 · 7 comments
Open

Uncaught TypeError: Cannot read property 'msie' of undefined #26

vanduc1102 opened this issue May 31, 2015 · 7 comments

Comments

@vanduc1102
Copy link

I use jQuery v1.11.3 | (c)

@rista404
Copy link

$.browser was removed from jQuery starting with version 1.9.

You can add this code before jFeed plugin.

jQuery.browser = {};
(function () {

    jQuery.browser.msie = false;
    jQuery.browser.version = 0;

    if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
        jQuery.browser.msie = true;
        jQuery.browser.version = RegExp.$1;
    }
})();

Hope this helps, cheers!
Cheers!

@vanduc1102
Copy link
Author

Thanks,I will try.

@Calosha
Copy link

Calosha commented Apr 8, 2016

solution doesn't work in
`JFeed.prototype = {

type: '',
version: '',
title: '',
link: '',
description: '',
parse: function(xml) {

    if (jQuery.browser.msie) {
        var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.loadXML(xml);
        xml = xmlDoc;
    }

    if (jQuery('channel', xml).length == 1) {

        this.type = 'rss';
        var feedClass = new JRss(xml);

    } else if (jQuery('feed', xml).length == 1) {

        this.type = 'atom';
        var feedClass = new JAtom(xml);
    }

    if (feedClass) jQuery.extend(this, feedClass);
}

};jQuery.browser.msie is undefined?! any ideas why? I declared jQuery.browser = {};
(function () {

jQuery.browser.msie = false;
jQuery.browser.version = 0;

if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
    jQuery.browser.msie = true;
    jQuery.browser.version = RegExp.$1;
}

})();` before the plug-in

@kintaro1981
Copy link

@Calosha in my case it worked

I simply added that code after:

 <script type="text/javascript">

@iamrutvik
Copy link

Add this function on the top of the file

`function detectIE() {
var ua = window.navigator.userAgent;

// Test values; Uncomment to check result …

// IE 10
// ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';

// IE 11
// ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';

// Edge 12 (Spartan)
// ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0';

// Edge 13
// ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586';

var msie = ua.indexOf('MSIE ');
if (msie > 0) {
    // IE 10 or older => return version number
    return true;
}

var trident = ua.indexOf('Trident/');
if (trident > 0) {
    // IE 11 => return version number
    var rv = ua.indexOf('rv:');
    return true;
}

var edge = ua.indexOf('Edge/');
if (edge > 0) {
    // Edge (IE 12+) => return version number
    return false;
}

// other browser
return false;

}`

Replace jQuery.browser.msie to detectIE() in whole file.

@iamrutvik
Copy link

copy it from "function detectIE() " this line. I dont know why they printed outside code block

@ijidak
Copy link

ijidak commented Jul 8, 2017

You can also simply use the jQuery Migrate plugin which is for this intended use case. See https://github.com/jquery/jquery-migrate/tree/1.x-stable#readme.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants