jQuery Form Plugin : XMLHttpRequest cannot load http://www…No 'Access-Control-Allow-Origin'

拈花ヽ惹草 提交于 2019-12-12 03:28:02

问题


I developed a file manager based on jQuery Form Plugin plugin

Recently, i find myself in front of this error

XMLHttpRequest cannot load http://www.****.com/. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://****.com' is therefore not allowed access.

This don't happen before. It doesn't happen with all files, but in my last case happens with an .zip file (a zip file with images , 50MB , but i think this isn't important).

I have read several questions on SO about a similar problem, but not when loading a file


回答1:


It looks like you have misinterpreted the problem. I doubt it has anything to do with the size of the file.

Look at the error message:

cannot load http://www.test.com/ and 'http://test.com' not allowed access.

You're changing the site you are loading in your browser from www.test.com to test.com and are making it a cross-origin request in the process.

  • Use relative URLs in your code
  • Pick one hostname to host your site on
  • Redirect requests from the other hostname to it


来源:https://stackoverflow.com/questions/36887480/jquery-form-plugin-xmlhttprequest-cannot-load-http-www-no-access-contro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!