Welcome to WebmasterWorld Guest from 3.214.184.124

Forum Moderators: open

Message Too Old, No Replies

Alternative to Ajax XMLHttpRequest domain limitation?

ajax

     
3:47 pm on Jan 27, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:May 22, 2008
posts:92
votes: 0


I have an interactive Ajax application that loads within a <div></div> embedded into my static html pages. The application nicely expands as required automatically (unlike an iframe would).

A limitation is that the Ajax data must be located on the same domain due to XMLHttpRequest security that does not allow it to pull data from other domains.

Is there any other way to embed my application using javascript so that my application may be shared amongst various domains I own?

Thank you,

Jason

P.S. I would like for the solution to be client side javascript and not a server side solution. The reason is that I have some html & php sites that I'd like to embed the app into. The reason that I don't use an iframe is that the height for the app expands during use.

7:59 pm on Jan 28, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:May 22, 2008
posts:92
votes: 0


I suppose that this is an XMLHttpRequest limitation that I'll have to live with.

Other than an iframe, the only alternative would be embedding the html (from the other domain) on the server and not on the client because of the limitation.

8:50 pm on Jan 28, 2009 (gmt 0)

Senior Member

joined:Nov 12, 2005
posts:5967
votes: 0


>> html & php sites

PHP is a server-side technology. You would be able to do it with that.

10:11 pm on Jan 28, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 13, 2002
posts:662
votes: 0


There are ways around it, in short, as long as you control the domains and code, you'll be able to to

Refer to the following:
[ejohn.org...]

Silverlight...
[msdn.microsoft.com...]

There's other techniques as well
[codeproject.com...]

11:42 pm on Jan 28, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:May 22, 2008
posts:92
votes: 0


eelixduppy, thanks for the response.

> html & php sites

>> PHP is a server-side technology. You would be
>> able to do it with that.

This was something I had considered before embedding my application with AJAX. What I was going to do was to write a C++ filter that intercepts the http request, scans for tags within the html of the desired page, i.e. {{my_app}} and then gets and insert the application's html within the tag.

Pro:

1) no ajax nor javascript required.
2) the entire page including the embedded application's data gets indexed by search engines.
3) can be used on html, php, or any other site.

Con:

1) no more web server buffering of html files since the file is read and dynamic data is inserted within each request.

I have an older, heavily used server and don't want to burden it further, so I chose the AJAX method even though it seems that the AJAX data does not get indexed by search engines.

11:43 pm on Jan 28, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:May 22, 2008
posts:92
votes: 0


Gibble,

Thanks for providing the links, very interesting, especially the one about ajax proxy.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members