有谁知道javascript中的domain是做什么的?

linfei 2003-02-12 12:10:24
<SCRIPT language=JavaScript>
document.domain="edainfo.net";
</SCRIPT>

指的是什么意思?
...全文
413 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhjzh_zjz 2003-03-11
  • 打赏
  • 举报
回复
好,又学到一招
随风奔跑 2003-02-18
  • 打赏
  • 举报
回复
up。
正需要这个功能的阿。
早点知道就好了。
ysharp 2003-02-18
  • 打赏
  • 举报
回复
gz
aawww 2003-02-12
  • 打赏
  • 举报
回复
up,长见识了!
Go_Rush 2003-02-12
  • 打赏
  • 举报
回复
同理

cookies也是不能跨域访问的,但是

设置cookies的domain后,情况就不同了

http://expert.csdn.net/Expert/topic/1417/1417668.xml?temp=.8194391
xuzuning 2003-02-12
  • 打赏
  • 举报
回复
document.domain="edainfo.net";
使浏览器能够接受来自xxx.edainfo.net的文档,应为那些服务器做的安全保护
airlulu 2003-02-12
  • 打赏
  • 举报
回复
哈哈,长见识了~
Go_Rush 2003-02-12
  • 打赏
  • 举报
回复
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了
linfei 2003-02-12
  • 打赏
  • 举报
回复
这么久了还没翻译过来?
aawww 2003-02-12
  • 打赏
  • 举报
回复
暴,看你拐子等哈跟你翻译:)
linfei 2003-02-12
  • 打赏
  • 举报
回复
谁能翻译一下?
gzh_seagull 2003-02-12
  • 打赏
  • 举报
回复
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.

87,901

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧