Current best practices for loading content from another domain
I'm tasked with working on a project where we want to laod content from another domain and push it into an id in our page.
Normally, I'd say have a proxy script to handle this but am curious if there is a better sol'n. Perhaps better to include page on other server that just document.writes out other content?
Is there a better current sol'n supporting say IE7+ and FF3+? Do YQL sol'ns support IE?
EDIT
It's a mixed RoR / PHP service - this section is PHP. HttpHandler looks good - kinda like a local proxy using file_get_contents but with some extra functionality.Re document.writing out html -开发者_如何转开发 this is the way I'm leaning torwards as JSONp might introduce headaches to end developers who will range greatly in skill set. Would I be insane to do this (ok, more insane)?!
thx
I don't know what server side code you are using but, in the past I've used an http handler in asp.net. Dave Ward did a good tutorial on this.
http://encosia.com/use-asp-nets-httphandler-to-bridge-the-cross-domain-gap/
This is good because it doesn't go through the entire page life cycle, so it is quicker than adding a page that serves up the data through response.write.
Current best practice would be to use a jsonp service, if you have control over the other domain. If you don't, then you're probably best off setting up a proxy service on your own domain.
精彩评论