I am having following error when i open my site on IE 8,
Message: Object doesn't support this property or method
Line: 25
Char: 13
Code: 0
URI: mycode.js
mycode.js FILE CODE
var LstCompanies = Object.keys(msg);
if (LstCompanies.length > 0) {
any ideas
Object.keys doesnt supported in IE.
Here is the safer implementation which is compatible with all browsers..
Object.keys = Object.keys || function(o) {
var keysArray = [];
for(var name in o) {
if (o.hasOwnProperty(name))
keysArray.push(name);
}
return keysArray;
};
Your browser (let me guess, it's Internet Exploder on WinXP?) does not support Object.keys
Iterate the old-fashioned way over the object instead.
for (var i in msg){
msg.hasOwnProperty(i){
// Here you have your keys
}
}
or use the shim mentioned in the MDN article.