1

How to set header Access-Control-Allow-Origin for XDomain

i am trying to do this by java code or by script code.

Please suggest me some way.

Amit
  • 196
  • 4
  • 16
  • What are you trying to access? The headers are set by the server most of the time, unless you are processing the request by code. – werfu Sep 18 '12 at 12:35
  • i am trying to solve this problem http://stackoverflow.com/questions/4739384/xdomainrequest-problem – Amit Sep 18 '12 at 12:43

1 Answers1

0

Here's all the information you need to enable CORS.

The easiest way to do it is by creating an .htaccess file inside the directory that you want to serve with the headers with this line:

Header set Access-Control-Allow-Origin *

In the link above, you can find plenty other methods. I'm sure some of them should suit you.

jbalsas
  • 3,484
  • 22
  • 25
  • You should mention that this is an Apache-only solution. As Java is mentioned the web server may be a Tomcat or something else. – Robert Sep 18 '12 at 14:15