[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


share site on facebook

Posted on 2012-08-20
Medium Priority
Last Modified: 2013-11-19

I want to place the Facebook icon on my website, so the visitors could share it.

I placed the codes and it is not working.

please can someone help me?

under body:

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="http://www.mysite.com/" data-send="true" data-width="450" data-show-faces="true"></div>
Question by:Romacali
  • 3
  • 2
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 38314291
Check out http://sharethis.com/ it will make your life easier.
LVL 18

Accepted Solution

Rartemass earned 1500 total points
ID: 38314306
This code works for me:

<div id="fb-root"></div>
                      <script src="http://connect.facebook.net/en_US/all.js"></script>
                      appId : 'YOUR APP ID',
                      status : true, // check login status
                      cookie : true, // enable cookies to allow the server to access the session
                      xfbml : true, // parse XFBML
                      channelUrl : 'http://your.domain.com/channel.html', // channel.html file
                      oauth : true // enable OAuth 2.0
                      <fb:like class="fb" href="http://your.domain.com" layout="standard" show-faces="false" width="225" height="60" action="like" colorscheme="light" />

Author Comment

ID: 38314948
I tried the code below, the problem is that it shows the like button and how many likes it if I'm logged in Facebook.

I want the Share on facebook, that display even if you are not logged in. When you click it would open a new window to login on FB and then you could share the page/site

any tip?
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 18

Expert Comment

ID: 38315071
While it is the like button, it shows the number of likes regardless of your login status. Clicking it does prompt you to log into Facebook if you are not already.

Author Comment

ID: 39566237
I've requested that this question be deleted for the following reason:

yes===delete because i got it to work
LVL 18

Expert Comment

ID: 39566938
This is a good resource for other EE users. While the code may not be exactly what worked for the asker it may assist others. Perhaps it will be better PAQed.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
When you put your credit card number into a website for an online transaction, surely you know to look for signs of a secure website such as the padlock icon in the web browser or the green address bar.  This is one way to protect yourself from oth…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses
Course of the Month19 days, 3 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question