Hacker News new | ask | show | jobs
by okpatil 4598 days ago
Phonegap seems to be a nice idea. But how do you implement CORS for such app ?
1 comments

Do you need to? It's not website-to-website communication.

If you do need to it's very simple, your web server has to include some extra headers:

  "Access-Control-Allow-Origin", "*"
  "Access-Control-Allow-Methods", "GET,POST" // etc
  "Access-Control-Allow-Headers", "X-Requested-With,Content-Type"
It seems that I need to. When I don't, it gives "Origin null is not allowed by Access-Control-Allow-Origin" error.