I happened across a REST standard for importing remote content today called oEmbed. It uses REST to display embedded content from other websites. This specific method avoids (but doesn’t get rid of) XSS issues that are experienced with importing content from other websites. Using either JSON or XML, you make a GET request using the oEmbed standard, which will return the remote content that you can embed into your own website.
There are many ways to do this, but using this method, you can gain a higher level of usability over user-entered content in your own web applications. For example, imagine your end-user having to add a YouTube video into an online editor. They’d have to:
For anyone reading my blog, this is a trivial task that can take less than a minute. However, the average website visitor will not be able to or be confident enough to go through those seemingly simple steps. Instead, wouldn’t it be easier to just have them paste the URL of the webpage into the text portion of the editor and just save the content? Of course! That’s where oEmbed steps in.
By implementing oEmbed, you can just have your visitor paste the YouTube URL into the content area, and save it. However, you’d use oEmbed to switch out that URL for the actual content. Turning something like this:
You can find a code sample for this on the documentation of the oEmbed wrapper for .Net. And the best part is that you are not limited to only YouTube. Using the oEmbed API Wrapper for .Net, you can do this will various videos, photos, and other embeddable content, such as widgets.
In this first release, I have given you all of the tools to make this happen in your own web applications:
Download and try out this for yourself. I’d love to get your feedback.