I had a project at work (jux.com
) where I was adding client-side metadata fetching for videos. Both Vimeo and Youtube offer oEmbed
APIs, but Youtube doesn't have-cross domain support, CORS
doesn't work in older browsers, blah blah blah.
I built a little service in Node to proxy requests to APIs that don't support CORS or JSONP (which I demoed at Hack&Tell a while ago
), but just wrote a little jQuery plugin that wraps jQuery.ajax()
to handle the browser detection and proxy configuration for you (where necessary). This means painless requests in any browser to any URL.
url: 'http://jsonview.com/example.json', // any JSON endpoint
corsSupport: true, // if URL above supports CORS (optional)
jsonpSupport: true, // if URL above supports JSONP (optional)
// error, etc.
Hope it comes in handy for someone else! More info here: