views:

36

answers:

3

Hi,

I am building a small widget that I am giving to users to embed in their websites and blogs. Now the widget loads a javascript file in the page where it is embedded from my server, which in turn puts an xmlhttp request back to my server to obtain data. Due to security reasons this request is being blocked when placed on other server (except my server). I need a solution to this.

I have searched a lot for a solution.

I am sure I cannot use the proxy solution here as the domains on which the script will be running is not controlled by me.

Also, I cannot use iframe due to Search engines.

What could be a possible solution?

Thanks,

happyhardik

+5  A: 

To my knowledge, using JSONP is the only way to do this.

Also, I cannot use iframe due to Search engines.

This I don't understand, though: If your widget is JavaScript driven, it won't turn up in any search engines anyway, will it?

Pekka
Yes, I understand that, but along with javascript there are a few links too! (static links) :)
happyhardik
A: 

This is pretty much a duplicate of any number of related queries. e.g.

http://stackoverflow.com/questions/2538215/cross-domain-scripting-issues-jsonp

Basically you want to use JSONP.

EDIT: I see Pekka has already said this.

Sean Hogan
A: 

Hi,

Browsers do not support cross domain ajax requests due same origin policy. You can check out this javascript library: ACD.

Abdel Olakara