javascripthtmlfbmlxfbml

Adding a Facebook like button to my markup using iframe document not working


I tried my possible best to make it work but I couldn't.

This is what I did.

  1. follow the instructions on https://developers.facebook.com/docs/plugins/like-button
  2. copy and paste my iframe tag to my test.html file inside the <body>.
  3. horiyang is the name of the facebook.

    <!DOCTYPE HTML>
    <html>
    <body>
    <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Ffacebook.com%2Fhoriyahng%2F&amp;width=200x200&amp;layout=standard&amp;action=like&amp;show_faces=true&amp;share=true&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200x200px; height:80px;" allowTransparency="true"></iframe>
    </body>
    </html>
    

Solution

  • please add https: before // in your iframe tag like this

    <iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Ffacebook.com%2Fhoriyahng%2F&amp;width=200&amp;layout=standard&amp;action=like&amp;show_faces=true&amp;share=true&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:80px;" allowTransparency="true"></iframe>
    

    This is fiddle link where your box is working check it. http://jsfiddle.net/u5Lgeg5e/