问题
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