Sharing in Facebook without meta tags on your page

Typically when you decide to share a link on Facebook it reads through the meta tags on the page the link points to in order to obtain thumbnails and other information to display in the post. Unfortunately it’s hard to meta tag each and every HTML page if you a) have a flash site or b) a site where everything is being generated on the fly – e.g. everything runs off of index.php

After much digging (I take no credit for this) the following JavaScript based share allows you to specify everything for your share:

function shareFacebook(title,summary,image, link){
http://www.facebook.com/share.php?s=100&p[title]=”+encodeURI(title)+”&p[summary]=”+encodeURI(summary)+”&p[images][0]=”+encodeURI(image)+”&p[images][1]=”+encodeURI(image)+”&p[url]=”+encodeURI(link)
}

For some reason if you need to share one thumbnail, you need to specify images at index 0 & 1. For more thumbs, just continue to add more images to the [images] array.

Advertisement

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.