0

I need my JS app to fetch data from a remote server, which is, of course, blocked by the Same-Origin policy. I have considered (but not tried) several ways of doing this:

  1. Using JSONP
  2. Running my script in a Chrome extension and putting the required domain into permissions in manifest.json
  3. Making a request to my hosted php script, which could fetch the data from the website and display it for my XHR to read

Which of these would work the best (or work at all)? And have I overlooked any easier methods?

Bluefire
  • 13,519
  • 24
  • 74
  • 118
  • If you need this to be asynchronous, then (1) is your best bet. If you don't mind the load on your server then (3) is easy to code. Stay away from (2). – Floris Jun 02 '14 at 11:35
  • The easiest method would be implementing CORS. – Rob W Jun 02 '14 at 12:48

0 Answers0