user1930903
user1930903

Reputation:

Facebook like button iframe code not showing

I have just started to create a new website, which is currently not on the internet. My very first website so everything is new to me. I'm trying to implement the Facebook like button. I have inputted the code but nothing is being displayed. I am using TextWrangler to create the website and using MacBook Air. Not sure if this information will help. Perhaps it's not working because of the meta properties? I didn't quite understand what information I needed to input there.

Here is my code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>[]</title>
<meta property="og:title" content="The []" />
<meta property="og:type" content="website" />
<meta property="og:url" content="file:///Users/[]/Documents/Sites/IBS.html" />
<meta property="og:image" content="http://[].jpeg" />
<meta property="og:site_name" content="The []" />
<meta property="fb:admins" content="218100060" />
</head>
<body>
<p>hello</p>
<iframe   src="//www.facebook.com/plugins/like.phphref=file%3A%2F%2F%2FUsers%2Fshikhaverma%2FDocuments%2FSites%2FIBS.html&amp;
send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;font=arial&amp;
colorscheme=light&amp;action=like&amp;height=80" scrolling="no" frameborder="0" 
style="border:none; overflow:hidden; width:450px; height:40px;" allowTransparency="true">
</iframe>
</body>
</html>

If you can help I would greatly appreciate it. Thank you.

Upvotes: 0

Views: 4738

Answers (1)

user752723
user752723

Reputation:

The problem is that the code you provided is double escaped. Which means that they are "&amp"s everywhere in the iFrame URL (src) code you provided:

//www.facebook.com/plugins/like.phphref=file%3A%2F%2F%2FUsers%2Fshikhaverma%2FDocuments%2FSites%2FIBS.html&amp;
send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;font=arial&amp;
colorscheme=light&amp;action=like&amp;height=80

Try pasting the url in your web browser, and it won't work, because it's so mal-formed.

Besides, Facebook like button can't use a local url to like, (in this case you used file:///Users/shikhaverma/Documents/Sites/IBS.html. ). It has to be using an online, functioning URL. So for now, just enter any random URL of an online website untill you get your site hosted online.

I un-escaped the url, and it's still mal-formed. It should be "like.php?href=file" instead of "like.phphref=file". Why don't you just go back to Facebook and re-generate the code.

Also, is there a problem with your code editor? Why is everything getting double-escaped?

Edit: By the way, you can always utilize the unescape() JavaScript command to unescape text. More here on Mozilla dev.

Upvotes: 1

Related Questions