Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Embed shared links with live preview

Saturday, January 19th, 2013 by Servage

Have you ever wondered how social media portals create the smart Share-a-link functions, where you get to see a little preview of the page you want to share? It’s actually very nice functionality and clever as well. Thankfully such an implementation is not as difficult as you might think. Basically you canĀ circumventĀ most complexities by using an embed-provider like Embed.ly – who takes care of the difficult part.

How does it work?

You build your own sharing interface in your web app, but behind the scenes, you request Embed.ly to scrape the posted URL, and it will return with a set of information about the page, which you can use in your preview. E.g. title, description text, image etc. This is pretty clever, because it figures out what is the relevant content to preview and can scrape pretty much any website. Furthermore they collaborate with different content providers to optimize the process for content from their sources.

Example

http://api.embed.ly/1/oembed?key=:key&url=:url&maxwidth=:maxwidth&maxheight=:maxheight&format=:format&callback=:callback

The above is an example URL calling the Embed.ly API and requests to scrape one specific URL. Beware that there are placeholders in this URL, so you would have to fill in the relevant data for your request.

If you want a peak at how it would work with URLs you wish to share, then have a look at the testing function here.

Embed shared links with live preview, 4.7 out of 5 based on 3 ratings
Categories: Software & Webapps

Keywords: ,

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.