Donicia Galbreaith
Donicia Galbreaith

Reputation: 1

like and send options for a website

I may not be looking in the correct place, but I am trying to add a LIKE and SEND option on my business website. My website is written using html 4. The only info I found on FB for these options is written for html 5 or xfbml or iframe. I copied the code and pasted it to my website as instructed, but it does not show the boxes or seem to work correctly. Does anyone know if I can use these options with html 4?

Upvotes: 0

Views: 507

Answers (2)

Danish Iqbal
Danish Iqbal

Reputation: 1464

Below is solution for your problem step by step :)
As I guess your code is not working because you not use javascript properly

You can solve your problem in 5 Steps

Step 1

Create a new facebook app using the link and note its App ID/API Key

Step 2

use your App ID/API Key which you note in Step 1

The following code will load and initialize the JavaScript SDK with all common options. Replace YOUR_APP_ID and WWW.YOUR_DOMAIN.COM with the appropriate values. The best place to put this code is right after the opening <body> tag.

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
FB.init({
  appId      : 'YOUR_APP_ID', // App ID
  channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
  status     : true, // check login status
  cookie     : true, // enable cookies to allow the server to access the session
  xfbml      : true  // parse XFBML
});

// Additional initialization code here
  };

  // Load the SDK Asynchronously
  (function(d){
 var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
 js = d.createElement('script'); js.id = id; js.async = true;
 js.src = "//connect.facebook.net/en_US/all.js";
 d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
</script>

Step 3

Create a channel.html file with the below code

  <?php
    $cache_expire = 60*60*24*365;
    header("Pragma: public");
    header("Cache-Control: max-age=".$cache_expire);
    header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$cache_expire) . ' GMT');
  ?>
  <script src="//connect.facebook.net/en_US/all.js"></script>

Step 4
Add an XML namespace to the <html> tag of your document. This is necessary for XFBML to work in earlier versions of Internet Explorer.

<html xmlns:fb="http://ogp.me/ns/fb#">

Step 5
Place the code for your plugin wherever you want the plugin to appear on your page and don't forget to replace WWW.YOUR_DOMAIN.COM with your domain name

<fb:like href="WWW.YOUR_DOMAIN.COM" send="true" width="450" show_faces="true"></fb:like>

You can read all the above in details where the almost all information is get below is the links

  1. here you can get like plugin and other details
  2. here you can get javascript, channel file details and other details

Upvotes: 2

Nadav S.
Nadav S.

Reputation: 2459

As evanmcd said, but with a plus+:

You don't have to know HTML5 or XFBML (IFRAME is still not supported). Just copy the code from here: http://developers.facebook.com/docs/reference/plugins/like/ and use it. XFBML is supported in all browsers (actually, it doesn't have to be supported, it's a part of facebook (xFaceBookml). I hope it helps... remember that you don't have to know it.

Upvotes: 1

Related Questions