Sunday, 3 July 2016

javascript - XMLHttpRequest Cannot Load https://[website].com Cross Origin Requests are not supported

I ran my JavaScript file with phantomjs --web-security=no myfile.js successfully in my MacBook (with macOS), but fail to run it on Ubuntu, where it give out this error:



XMLHttpRequest Cannot Load https://[website].com Cross Origin
Requests are not supported


I find my problem is different from questions below





  1. XMLHttpRequest cannot load Cross origin requests are only supported for HTTP

  2. XMLHttpRequest cannot load https://www.[website].com/



For the first one, my error message is simply 'not supported', but not tell my 'only supported for HTTP' (though I send request to a HTTPS url).
For the second one, my error message doesn't require the 'Access-Control-Allow-Origin' header.



I tried --debug=true option for PhantomJS, and it turned out that when running within Ubuntu, the PhantomJS silently dropping cookies.




Under my circumstance, could any one tell me how to fix this?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...