tags:

views:

29

answers:

1

Hi there,

Is there any way to tell your localhost that it can do cross domain ajax calls?

I need this for my testing.

If it is a browser specific issue i am using google chrome.

Cheers.

A: 

No, it's absolutely not possible. If it could be disabled by the user then it would be the main target for anyone with nefarious or dubious intent, and as prone as any other software to exploitation. It's difficult enough making secure software, without painting on even more attractive targets.

The only way to implement cross-domain Ajax is to route requests via a server-side script.

It's worth mentioning that there is, perhaps, a glimmer of hope for you: in the form of cross-window messaging with HTML 5 postMessage

It's probably worth your having a read of some related (though I'm not sure they're duplicate) questions:


Edited in response to comment:

So you mean have a script that takes the params, adds them to the request, sends it out, and then echos out the response object?

Essentially yes. In picture format:

client  |--------------> | server side |----------------------->  | remote domain
browser | <----ajax------|   script    | <------------------------|--/
David Thomas
So you mean have a script that takes the params, adds them to the request,sends it out,and then echos out the response object?
Hailwood
@Pourquoi, thank you. I hadn't realised I'd left it un-done =)
David Thomas