This works in all browsers:
for (var i in navigator) {
console.log(i, ':', navigator[i]);
}
But this doesn’t work in IE 6 or 7: (loops zero times)
for (var i in screen) {
console.log(i, ':', screen[i]);
}
What’s different about the screen object?
And more importantly, how would I go about looping through it in IE?
When I run tests, IE9 lets you get all the properties off the screen object with:
But, it won’t let you access some of the properties to get their value. When you do so, it stops JS execution. It doesn’t even throw an exception that you can catch.
Yes, this is brain dead, but it’s not out of character with things that IE does, even in IE9.
If you really need to do this, you could one at a time figure out which properties IE doesn’t work with and code to test for those and avoid them. It might have to be updated from version to version, but it could get you going for whatever you’re trying to do.