今天写Ajax的demo时,在谷歌浏览器下调用失败,报错输下:

 

XMLHttpRequest cannot load file:///H:/%E5%89%8D%E7%AB%AF%E7%BB%83%E4%B9%A0/jquery/Ajax/demo.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

原因:谷歌浏览器对Ajax进行了严格的安全的限制

解决办法:在server端进行测试,不要在本地测试。如发布到tomcat等,测试正常

相关文章:

  • 2022-01-09
  • 2021-10-02
  • 2021-12-07
  • 2022-12-23
  • 2021-07-10
猜你喜欢
  • 2021-07-16
  • 2022-02-15
  • 2021-12-13
  • 2021-12-30
  • 2022-12-23
  • 2021-05-20
相关资源
相似解决方案