The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Facebook Plugin
Zac
post Jan 8 2014, 12:35 PM
Post #1





Group: Members
Posts: 2
Joined: 8-January 14
Member No.: 20,195



I'm trying to add a Facebook "Like" Box onto a webpage, and it wont show up.

this is my code.


<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-box" data-href="http://www.jjgraphics.ca" data-width="100" data-height="100" data-colorscheme="dark" data-show-faces="true" data-header="true" data-stream="true" data-show-border="true"></div>


I placed the top paragraph just below the opening <body> tag, and I placed the second paragraph into my main container.

This post has been edited by Zac: Jan 8 2014, 12:37 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Sorryboss
post Jan 8 2014, 05:43 PM
Post #2


Member
***

Group: Members
Posts: 41
Joined: 2-September 12
Member No.: 17,724



I'm definitely not a JS expert, but you're getting the element "id" in your JS, and your HTML mentions no such element. I'd start with that.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jan 8 2014, 07:30 PM
Post #3


.
********

Group: WDG Moderators
Posts: 8,251
Joined: 10-August 06
Member No.: 7



QUOTE(Zac @ Jan 8 2014, 06:35 PM) *

I'm trying to add a Facebook "Like" Box onto a webpage, and it wont show up.

What javascript errors are you getting? Can you link to a sample page?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jan 8 2014, 07:34 PM
Post #4


.
********

Group: WDG Moderators
Posts: 8,251
Joined: 10-August 06
Member No.: 7



QUOTE(Sorryboss @ Jan 8 2014, 11:43 PM) *

I'm definitely not a JS expert, but you're getting the element "id" in your JS, and your HTML mentions no such element. I'd start with that.

I think the "id" function parameter is defined in the function call as "facebook-jssdk" and is given to a new SCRIPT element the javascript creates. Then that new SCRIPT element loads yet another javascript file from Facebook's server.

No idea what's the point in doing all that, instead of just asking to site owner to add it all in from the start. unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Jan 9 2014, 03:36 PM
Post #5


This is My Life
*******

Group: Members
Posts: 1,125
Joined: 24-August 06
From: t-dot
Member No.: 16



The `href` parameter must reference a valid Facebook page, but "http://www.jjgraphics.ca/" is not a valid Facebook page.

this works
CODE
<div class="fb-like" data-href="https://facebook.com/longobongo" data-width="150" data-layout="standard" data-action="like" data-show-faces="false" data-share="false"></div>  
see http://longobongo.com


This post has been edited by jimlongo: Jan 9 2014, 03:37 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Zac
post Jan 10 2014, 11:32 AM
Post #6





Group: Members
Posts: 2
Joined: 8-January 14
Member No.: 20,195



QUOTE(jimlongo @ Jan 9 2014, 02:36 PM) *

The `href` parameter must reference a valid Facebook page, but "http://www.jjgraphics.ca/" is not a valid Facebook page.

this works
CODE
<div class="fb-like" data-href="https://facebook.com/longobongo" data-width="150" data-layout="standard" data-action="like" data-show-faces="false" data-share="false"></div>  
see http://longobongo.com



Awesome, thanks! biggrin.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 5th December 2019 - 04:43 PM