問題描述
var xhttp=new XMLHttpRequest();
xhttp.open('GET', 'foo.xml', false);
F12 彈回:SCRIPT5:訪問被拒絕.在第 95 行,即 xhttp.open 行.
F12 pops back: SCRIPT5: Access is denied. on Line 95, which is the xhttp.open line.
我的 JavaScript 看起來格式正確,Firefox 做了我認為應該做的事.
My JavaScript seems well-formed, and Firefox does what I think it should.
我已經閱讀了很多與此問題非常相似的問題,因此我查看了同源策略,但考慮到 foo.xml 與.html 文件.我在本地 Intranet 上打開了腳本權限,并告訴 McAfee 休息五分鐘,以確保安全.我什至嘗試以管理員身份運行 IE,所以這真的不是權限問題嗎?為什么 IE 會被拒絕訪問本地文件?
I've read a lot of questions very similar to this one, so I've checked out the Same Origin Policy, but I can't see how it'd apply considering foo.xml is in the same directory as the html file. I opened up the scripting permissions on my local intranet, and told McAfee to take a five-minute break, just to be sure. I even tried running IE as admin, so this can't really be a permissions issue can it? Why else would IE be denied access to a local file?
推薦答案
也許你想看看下面的鏈接:
Maybe you like to check the links below:
- 使用 XMLHttpRequest 或 XDomainRequest 進行跨域 JavaScript 請求
XMLHttpRequest
– Mozilla 開發者網絡- 對 jQuery x 域請求的一個很好的總結
- 哪種瀏覽器支持x域?
- Making cross domain JavaScript requests using XMLHttpRequest or XDomainRequest
XMLHttpRequest
– Mozilla Developer Network- A good summary of the jQuery x-domain requests
- Which browser supports x-domain?
這篇關于SCRIPT5:在 IE9 中對 xmlhttprequest 的訪問被拒絕的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!