HelloCW
HelloCW

Reputation: 2325

Could you tell me why the code don't display facebook Like button

I use the follwing code to display Facebook Like button, but I havn't got result, why?

The code is copied from FaceBook, it seems that the code lost http:

Thanks!

<html>
    <head>
      <title>My Great Web page</title>
    </head>
    <body>
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.hicalc.com%2F&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>

 </body>
 </html>

Upvotes: 0

Views: 573

Answers (2)

Chris Morgan
Chris Morgan

Reputation: 90852

The omission of http: is intentional, valid and correct. It means that it will be on the same protocol that you are on.

  • For http://example.com, it'll use http://www.facebook.com
  • For https://example.com, it'll use https://www.facebook.com
  • For file:///example, it'll use file://www.facebook.com

This last is what I imagine is tripping you up; it won't work on a local file.

Either (a) use a local web server so that it's http://localhost (a good idea as it removes the potential for various security restrictions and problems and makes the development environment more like the deployment environment) or (b) prepend http: while it's in development (try to remove it for deployment).

Upvotes: 1

SeanCannon
SeanCannon

Reputation: 78006

Code works fine: http://jsfiddle.net/kYyQS/

Upvotes: 1

Related Questions