0

I have read, it is possible to do any cross-domain AJAX requests if only the server allows this explicitly. Now we are using a JavaScript program trying to send huge POST data to a virtual server running in a exe-file written in Delphi, using Indy library. The URL is 127.0.0.1:8084, the JavaScript program is embedded in a HTML, which is opened from the hard drive (so its URL is C:\Blabla...).

Of course there is the cross origin policy which makes it impossible to fulfill our task.

Any advices? Which headers we need to set in JavaScript? Which settings must be set in Indy?

Liglo App
  • 3,719
  • 4
  • 30
  • 54
  • Because the HTML is just double-clicked from hard drive and its URL is like 'C:\Some\Path' and it is not equal to '127.0.0.1:8084'. – Liglo App Aug 22 '14 at 09:55

1 Answers1

2

See jQuery Ajax request from local filesystem (Windows file:///)

  • the local file URL and the localhost server are not in the same domain, so the same origin policy kicks in
  • note that some brwosers (Chrome) for example will not allow Ajax requests from file:// URLs
  • set the CORS header(s) in the Indy server response headers, for example

Access-Control-Allow-Origin: *

Community
  • 1
  • 1
mjn
  • 36,362
  • 28
  • 176
  • 378