Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook/Twitter "Like" buttons in pure html

I'm trying to add share buttons to my simple website...

  1. Is it possible to make a Facebook "like" button in pure html?

  2. Is it possible to make a Twitter "like" button in pure html?

like image 691
David19801 Avatar asked Dec 09 '22 11:12

David19801


2 Answers

From Facebook's developer documentation, insert the following into the body of your markup:

   <iframe src="https://www.facebook.com/plugins/like.php?href=YOUR_URL"
    scrolling="no" frameborder="0"
    style="border:none; width:450px; height:80px"></iframe>

(make sure you close the iframe tag, on the facebook website it is left open.)

And for twitter (found on a forum):

<a href="https://twitter.com/home?status=Enter status message here" 
 title="Click to send this page to Twitter!" target="_blank">Tweet This!</a>
like image 74
jball Avatar answered Dec 26 '22 19:12

jball


The Tweet Button is the recommend way for twitter, although a simple link like this works too, if you want to share a link:

  • http://twitter.com/share?url=http://example.com&text=Some%20tweet%20text

Similar, http://www.facebook.com/sharer.php?u= allows to share an URL as well.

There are probably more ways to share without using JavaScript (I remember some feature that preset the tweet text on the twitter homepage, but can't find it right now).

like image 23
poke Avatar answered Dec 26 '22 18:12

poke