Tutorial :IE error when trying for( var i in window.external )


I am building an object/property dump using JavaScript. This code breaks under Internet Explorer 8 (assuming subject = window.external)

// Gather the property names into the keys array.  var keys = Array(); for( var i in subject ){ keys.push(i); }    /* After this I sort the keys, then loop through to get the      property values in subject  */  

If you try printing subject to the console (or alert) it comes up blank. However, other objects will print [object SomethingMeaningful].

Microsoft's documentation suggests that the object definitely has properties. It would be nice to be able to show them instead of just skipping over them. Any Ideas?


Do you mean this?

var keys = Array(); for( var i in subject ){ keys.push(subject[i]); }  

You can access object properties with array like syntax in JavaScript


Thanks for the edit. I am not sure why that would not work for the window.external object. It may be that it has methods only, and no properties. Does it work under other browsers, for example, Firefox?

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »