Firefox setting to enable cross domain Ajax request
I need to temporally allow cross domain XMLHttpRequest. Changing firefox security setting seems to be the way to go. But I've tried with this and this but they didnt work. Has anyone been able to configure this before? Thanks.
If you just don't want to waste your time on cross-domain issues during development and testing of your app you can use addon Force CORS for FF.
UPDATE: It seems that this addon no longer exists. But there is another option - this Chrome extension
For modern browsers, you may try the following approach:
https://developer.mozilla.org/en/HTTP_access_control
In short, you need to add the following into the SERVER
response header (the following allows access from foo.example
):
Access-Control-Allow-Origin: http://foo.example
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: X-PINGOTHER
Access-Control-Max-Age: 1728000
Note that the X-PINGOTHER
is the custom header that is inserted by JavaScript, and should differ from site to site.
If you want any site access your server in Ajax, use *
instead.
Edit:
When I first answered the question by 2009, I actually hit the same problem, and I worked around it using the server side config.
There was no plugin on FF or Chrome by then.
However, now we do have alternatives using the browser side plugin, please check the answer of tsds