php: waiting for other slow websites

David Kramer david-8uUts6sDVDvs2Lz0fTdYFQ at public.gmane.org
Tue May 29 23:28:32 EDT 2007


Danny Robert wrote:
> It was my understanding (and admittedly I'm an AJAX n00b) that
> XMLHttpRequests were limited such that they can only make requests back
> to the originating server.  (The premise that this would reduce the
> possibilities of cross-site scripting and some security concerns.)
....
> The last advantage in writing a local service that can call out is to
> support David's AJAX suggestion.  If the service is local, there is no
> problem making the request back.  Your content can send an
> XmlHTTPRequest to your own service (say, getFlickerImages(...)) which
> does the grunt work but doesn't hinder the initial load time of the

Yes.  Sorry for not explicitly saying it, but that's what I had in mind. 
  The client-side JavaScript calls a page from your server which in turn 
gets the required third-party content.

In fact, if you're really good, you can have the PHP code start to 
gather the third-party content on the first request to reduce reply time 
on the second request, or even cache it periodically and print it from 
the cache.

One more "Nagging Nanny" point: Make sure you're allowed to use this 
third-party content legally.  Some website specifically restrict you 
from reusing/reposting their content.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.






More information about the Discuss mailing list