From the oEmbed site:

oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.

This would be great for third-party sites to embed questions. Here's how it could work:

Stack Overflow creates an oEmbed endpoint that takes a URL-encoded URL as a parameter. Any site that wants to embed a URL will call it like this:





It would then reply with a representation of that URL that can be embedded nicely:

    "version": "1.0",
    "type": "link",
    "width": 300,
    "height": 100,
    "title": "Flash CS4 refuses to let go",
    "url": "http://stackoverflow.com/questions/2193953/flash-cs4-refuses-to-let-go",
    "author_name": "Ender",
    "author_url": "http://stackoverflow.com/users/134658/ender",
    "provider_name": "Stack Overflow",
    "provider_url": "http://stackoverflow.com/"
    "html": "<html code that will display the question / answer embedded will be here>"

Additionally, it could be adjusted to return rich HTML, which would be nice if we wanted to include the score, or the user's avatar or something. That can be done with a type of 'rich'.

The oEmbed should also be discoverable, by adding a link tag to the document:

<link rel="alternate" type="application/json+oembed" href="stackoverflow.com/oembed.json?url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F2193953%2Fflash-cs4-refuses-to-let-go" title="Flash CS4 Refuses to Let Go" />

There are quite a few sites that already support oEmbed with great success such as YouTube, Flickr, Vimeo, Slideshare and WordPress. Here's an example of an oEmbed response from YouTube (that is easily taken from their autodiscovery tag.)

  • 9
    Could go the other way for one boxing in chat if this isn't already used for that.
    – Flexo
    Jun 15, 2012 at 19:30
  • 4
    Please also make it have JSONP handling like a lot of other oEmbed endpoints do. It makes it easier for client only applications. I also write a library that does a stack overflow embedding see github.com/starfishmod/jquery-oembed-all this may help in the meantime?
    – user190930
    Jul 18, 2012 at 1:38
  • 1
    Author name should be Ender
    – hjpotter92
    Apr 9, 2013 at 0:55
  • 2
    Seems like a bit of an XSS nightmare with the scrubbing necessary for every oEmbed being displayed...
    – Chris S
    Jun 8, 2013 at 3:40
  • @ChrisS: …what?
    – Ry-
    Jun 8, 2013 at 4:45
  • As an aside: YouTube (nowadays) returns an iframe (plus the meta data). The Speaker Deck example doesn't work for me today.
    – Arjan
    Aug 7, 2013 at 6:24
  • @ChrisS This is not about embedding things from other sites within Stack Exchange posts, it's about StackExchange providing an API to let other sites embed our questions - the same way you can embed a youtube video on a third party site.
    – JonasCz
    Nov 29, 2019 at 9:00


You must log in to answer this question.

Browse other questions tagged .