The property initially returns the host name of the server the page is served from. The property can be assigned the domain suffix to allow sharing of pages across frames. For example, a page in one frame from home.microsoft.com and a page from www.microsoft.com initially would not be able to communicate with each other. However, by setting the domain property of both pages to the suffix "microsoft.com", both pages are considered secure and access is available between the pages.

解决方案 »

  1.   

    document.domain主要是解决跨域访问的问题默认情况下,因为安全原因,浏览器是不容许跨域访问框架的比如:http://gorush.com/a.htm
    <body>
    <iframe id=t src="http://other.com/b.htm"></iframe>
    </body>这个时候a.htm是不能访问iframe中的文件b.htm的。因为他们在不同的域
    但是,如果b.htm里面包含了以下几行代码的话
    <SCRIPT language=JavaScript>
      document.domain="gorush.com";
    </SCRIPT>那么a.htm就可以完全访问b.htm了
      

  2.   

    document.domain="edainfo.net";
    使浏览器能够接受来自xxx.edainfo.net的文档,应为那些服务器做的安全保护
      

  3.   

    同理cookies也是不能跨域访问的,但是设置cookies的domain后,情况就不同了http://expert.csdn.net/Expert/topic/1417/1417668.xml?temp=.8194391