在看别人的代码过程中,见到了好几次对document.domain
进行的赋值操作,就像下面这样:
document.domain='hao.com';
但是我再查手册的过程中了解到
书上说document.domain是只读的,返回为一个字符串。
但是有的人为什么还要这样做呢?
有什么作用?难道不会报错吗?
还是有的浏览器支持此操作啊?
再或者是利用了浏览器的Bug?
进行的赋值操作,就像下面这样:
document.domain='hao.com';
但是我再查手册的过程中了解到
书上说document.domain是只读的,返回为一个字符串。
但是有的人为什么还要这样做呢?
有什么作用?难道不会报错吗?
还是有的浏览器支持此操作啊?
再或者是利用了浏览器的Bug?
Sets or retrieves the security domain of the document. Syntaxdocument.domain [ = sDomain ]
Possible ValuessDomain String that specifies or receives the domain suffix. The property is read/write. The property has no default value.
请看如下地址:
document.domain
http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html#ID-2250147
interface HTMLDocument : Document {
........................
readonly attribute DOMString domain;
........................
};在Mozilla的开发者文档中和MS的DHTML手册中都是读/写https://developer.mozilla.org/en/DOM/document.domain
document.domain
Gets/sets the domain of the current document.