打算先做一个本地运行的demo,就没有在WEB服务器上运行

 页面地址像这样C:\test.html

现在IE上试,XmlHttpRequest请求的地址如果是本地地址则不能运行,改成http://地址后通过

 

然而在其他浏览器Firefox,Opera,Chrome上则不能运行

Firefox的错误信息

 错误: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///C:/test.html :: <TOP_LEVEL> :: line 5"  data: no]


Opera错误信息

JavaScript - file://localhost/C:/test.html
Inline script thread
Error:
name: Error
message: Security violation
stacktrace: n/a; see  opera:config#UserPrefs|Exceptions Have Stacktrace

 

最后猜测可能是因为访问的的页面地址是本地,改为http://localhost/test.htm后运行通过-

相关文章:

  • 2022-12-23
  • 2021-08-04
  • 2021-12-28
  • 2021-12-01
  • 2022-01-10
  • 2022-02-20
  • 2021-06-22
  • 2021-09-24
猜你喜欢
  • 2021-06-15
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案