jFeed
jFeed copied to clipboard
Uncaught TypeError: Cannot read property 'msie' of undefined
I use jQuery v1.11.3 | (c)
$.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!
Thanks,I will try.
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 in my case it worked
I simply added that code after:
<script type="text/javascript">
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.
copy it from "function detectIE() " this line. I dont know why they printed outside code block
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.