Getting error: Origin null is not allowed by Access-Control-Allow-Origin.

I have a small WebStorm project with one html file, one javascript file, and one python file.  In the javascript file, I use jquery to do an AJAX request to local Apache server asking to execute the python file as a CGI file.  This works perfectly when I enter "http://localhost/~<my user name>/TestAjax/ajaxhtml.html" in Google Chrome or Firefox.  The python CGI file works fine.  However, if i enter "file:///Users/<my user name>/Sites/TestAjax/ajaxhtml.html" in Chrome or Firefox, the html file is rendered and the javascript is executed but the AJAX request to access the python CGI file fails.  If i then open the Google Web Inspector, I see this message: "XMLHttpRequest cannot load file:///Users/<my user name>/Sites/TestAjax/ajaxtest.py. Origin null is not allowed by Access-Control-Allow-Origin."  If I try to  debug from the WebStorm project, the browser always uses the "file://" location.  I've tried to use the "localhost" url's in my scripts but haven't been able to get it to work.  When I try to use the "localhost" location in the Run/Debug configuration, I get an error message: "Error: Cannot fine debug file."

Anyone run into this and know how to work around it?


WebStorm 5.0, Chrome 26.0.1410.28 beta, Firefox 19.0.2, Mac OS X 10.8.2



Please sign in to leave a comment.