Return to Snippet

Revision: 50484
at August 24, 2011 12:53 by pratheep


Initial Code
function share(type) {
	var url = window.location.href;
	var title = window.document.title;
	if(type == 'facebook') {
		window.open("http://www.facebook.com/share.php?src=bm&u=" + url + "&t=" + title);
	}else if(type == 'twitter') {
		window.open("http://twitter.com/home?status=" + url);
	}
}


<a href="#" onclick="share('facebook');">Facebook</a>
<a href="#" onclick="share('twitter');">Twitter</a>

Initial URL

                                

Initial Description
Share current page on Facebook wall or Twitter

Initial Title
Share  Facebook and Twitter

Initial Tags
twitter, facebook

Initial Language
JavaScript