Skip to content Skip to sidebar Skip to footer

Message: Object Doesn't Support This Property Or Method

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 L

Solution 1:

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; 
};

Solution 2:

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.

Post a Comment for "Message: Object Doesn't Support This Property Or Method"