使用xmlhttp跨域编写脚本 [英] Cross domain scripting with xmlhttp
问题描述
之前已经出现但我不确定最新版本的IE
和FF是否会改变答案。
运行的脚本网页由 http://foo.something.com 提供
应该能够做到
xmlhttp.open(" GET"," http://bar.something.com" true)
但是在Firefox 1.5中,我得到了Permission denied错误
为什么会这样?域名是something.com所以我不是跨域,
所以它为什么抱怨?
谢谢
This has come up before but I am not sure if the latest versions of IE
and FF change the answer.
A script running on a webpage served up by http://foo.something.com
should be able to do
xmlhttp.open("GET","http://bar.something.com",true)
But in Firefox 1.5, I get the Permission denied error
Why is this? The domain is something.com so I am not crossing domains,
so why is it complaining?
Thanks
推荐答案
VA写道:
VA wrote:
[...]
网页上运行的脚本由 http://foo.something.com
应该能够做到
xmlhttp.open(" GET"," http://bar.something.com",true)
但是在Firefox 1.5中,我得到了Permission denied错误
>这是为什么?该域名是something.com所以我不是跨域,
你是。阅读SOP(再次):
< URL:http://www.mozilla.org/projects/security/components/same-origin.html>
所以为什么抱怨?
[...]
A script running on a webpage served up by http://foo.something.com
should be able to do
xmlhttp.open("GET","http://bar.something.com",true)
But in Firefox 1.5, I get the Permission denied error
Why is this? The domain is something.com so I am not crossing domains,
You are. Read on the SOP (again):
<URL:http://www.mozilla.org/projects/security/components/same-origin.html>
so why is it complaining?
你忘了做
document.domain =" something。 com" ;;
之前。
HTH
PointedEars
You forgot to do
document.domain = "something.com";
before.
HTH
PointedEars
>
我已经尝试过,我仍然得到权限被拒绝在Firefox 1.5中调用
方法XMLHttpRequest.open
帮助?谢谢
I had already tried that, I still get the Permission denied to call
method XMLHttpRequest.open in Firefox 1.5
Help? Thanks
VA写道:
VA wrote:
我已经尝试过了,
试过什么?请引用您回复的最低要求。
< URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
我仍然得到权限被拒绝在Firefox 1.5中调用
方法XMLHttpRequest.open
帮助?
I had already tried that,
Tried what? Please quote the minimum of what you are replying to.
<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
I still get the Permission denied to call
method XMLHttpRequest.open in Firefox 1.5
Help?
更真实代码是必需的。
PointedEars
More real code is needed.
PointedEars
这篇关于使用xmlhttp跨域编写脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!