当我在浏览器中执行以下代码时:
for (propt in location) {
document.write("location property " + propt + " is currently: ");
document.write(screen[propt] + "<br />\n");
}
所有属性都是未定义的。为什么会这样?
这是输出:
location property assign is currently: undefined
location property replace is currently: undefined
location property reload is currently: undefined
location property ancestorOrigins is currently: undefined
location property origin is currently: undefined
location property hash is currently: undefined
location property search is currently: undefined
location property pathname is currently: undefined
location property port is currently: undefined
location property hostname is currently: undefined
location property host is currently: undefined
location property protocol is currently: undefined
location property href is currently: undefined