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
- XMLHttpRequest cannot load Cross origin requests are only supported for HTTP
- 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?