admin管理员组文章数量:1417070
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
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
Share Improve this question edited Dec 20, 2013 at 13:54 thefourtheye 240k53 gold badges466 silver badges501 bronze badges asked Jun 26, 2013 at 9:32 user2350607user2350607 131 silver badge5 bronze badges2 Answers
Reset to default 5Object.keys doesnt supported in IE. Here is the safer implementation which is patible 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.
本文标签: javascriptMessage Object doesn39t support this property or methodStack Overflow
版权声明:本文标题:javascript - Message: Object doesn't support this property or method - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745259718a2650300.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论