1

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

happyhardik
  • 24,987
  • 7
  • 47
  • 60
  • Yes, JSONP was one of the possible solution. But what worked for me was a combination of iframe and javascript and some static content. All mixed up, but now I am running into another trouble, how to dynamically change the height of the iframe.. :( but this question is different from this.. !! – happyhardik Jul 08 '10 at 05:45

3 Answers3

5

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
  • 442,112
  • 142
  • 972
  • 1,088
0

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

Cross Domain Scripting Issues & JSONP

Basically you want to use JSONP.

EDIT: I see Pekka has already said this.

Community
  • 1
  • 1
Sean Hogan
  • 2,902
  • 24
  • 22
0

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

Abdel Raoof Olakara
  • 19,223
  • 11
  • 88
  • 133