jFeed icon indicating copy to clipboard operation
jFeed copied to clipboard

Uncaught TypeError: Cannot read property 'msie' of undefined

Open vanduc1102 opened this issue 9 years ago • 7 comments

I use jQuery v1.11.3 | (c)

vanduc1102 avatar May 31 '15 16:05 vanduc1102

$.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!

rista404 avatar May 31 '15 17:05 rista404

Thanks,I will try.

vanduc1102 avatar May 31 '15 17:05 vanduc1102

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

Calosha avatar Apr 08 '16 19:04 Calosha

@Calosha in my case it worked

I simply added that code after:

 <script type="text/javascript">

kintaro1981 avatar May 10 '16 16:05 kintaro1981

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 avatar May 24 '16 12:05 iamrutvik

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

iamrutvik avatar May 24 '16 12:05 iamrutvik

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.

Kriel avatar Jul 08 '17 12:07 Kriel