IE6での話です。navigator.mimeTypes(clientInformation.mimeTypesでも同じ)というオブジェクトを、次のようなfor/in文で列挙しようとするとエラーが生じます。
for (var p in navigator.mimeTypes) {
// pで何かする
}
配列オブジェクトであったとしても、インデックス(番号)が、"0", "1", "2" といった文字列として列挙され(pに順次入る)と僕は思っていたのですが(Rhinoではそのような動作をします)、、、よくわかりません。次がテストに使ったファイルです。navigator.pluginsなどでも同様な現象が起きます。
<html>
<head>
<title>test</title>
<script><!--
function show(message) {
document.write(message + "<br>");
}
function objectExists(x) {
return typeof x == 'object' && x != null;
}
//-->
</script>
</head><body>
<script><!--show("* window.location exists: " + objectExists(window.location));
try {
for (var p in window.location) {
show(p);
}
} catch(e) {alert("Error in window.location");}show("* navigator.mimeTypes exists: " + objectExists(navigator.mimeTypes));
try {
for (var p in navigator.mimeTypes) {
show(p);
}
} catch(e) {alert("Error in navigator.mimeTypes");}
//-->
</script>
</body>
</html>
後で調べようとは思ってますが、どなたか事情をご存じでしょうか。