Solved

Social Media Buttons

Posted on 2014-01-03
4
467 Views
Last Modified: 2014-01-04
I'm trying to add social networking buttons to an html page, following the directions here:

http://blog.hubspot.com/blog/tabid/6307/bid/29544/The-Ultimate-Cheat-Sheet-for-Creating-Social-Media-Buttons.aspx

I've attached the file I created based on that blog and links to developer tools on Facebook and Google Plus.

I don't have a website set up, so am just opening the HTML file in Internet Explorer.

The Twitter and Reddit buttons work, bringing up login pages for those sites, but the Facebook and Google Plus buttons don't work.

Questions:

1.  Am I doing something wrong in the code?
2.  Would those buttons work if they were on a real website rather than just my test HTML file?
3.  Why do the Twitter and Reddit buttons work when the Facebook and Google Plus buttons don't?
social-netowrk-button.html
0
Comment
Question by:mbizup
  • 3
4 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 39755140
Hi mbizup,

1.  Am I doing something wrong in the code?

It's certainly possible given the instructions on that page are fairly unclear as the author goes into every possible permutation of social buttons.  So you may be conflating code from multiple sources...hard to say looking at the sample (q.v.)

2.  Would those buttons work if they were on a real website rather than just my test HTML file?

They would be different, yes.  The test file, especially a local one, doesn't have a fully qualified domain name (FQDN) and addressable URL and if the script being used to generate the button checks for that sort of thing, it would act differently.  You always want to test from a web server when possible.

3.  Why do the Twitter and Reddit buttons work when the Facebook and Google Plus buttons don't?

The Twitter button is just a simple link (<a> tag) so it will always work.  However, it will only show as a link because the CSS class "twitter-share-button" doesn't have a matching CSS file to work with.

The Reddit button is the same thing only combined with a full URL src'd image.  So that one looks and acts okay.

Google+ is using javascript to generate itself so it may not work from a local file preview but it should work fine on a real server (click your attachment above to see it work on EE's server).

The Facebook button is also using javascript to generate itself so it may need a full working server to be seen properly.  Additionally, you have a local image reference in that div: src="images/JFTIwebsite_logo.png" which will not work unless there is an image and a subdirectory present, so the button may be invisible on testing or on deployment.  Futhermore you have "data-href="http://www.HERPDERP.INSERTURLHERE.com"" in that div and if the Facebook script is testing for a header response from www.HERPDERP.INSERTURLHERE.com when it loads, it obviously won't get one.
0
 
LVL 61

Author Comment

by:mbizup
ID: 39755552
0
 
LVL 61

Author Comment

by:mbizup
ID: 39755553
Jason,

Thanks - great explanation (I couldn't have said it better myself ;-)  )

<<  (click your attachment above to see it work on EE's server) >>

Wow!  I never would have thought of that.

<< if the Facebook script is testing for a header response from www.HERPDERP.INSERTURLHERE.com >>

Double wow!  After my own failed attempts at this, I asked my son to take a stab at it.  I didn't notice that he had put what he called LOL code in there.  

As soon as I changed that to a real URL, it worked as an EE attachment -- see the attachment in my last comment.   (herp derp.)
0
 
LVL 61

Author Closing Comment

by:mbizup
ID: 39755554
Thanks!
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Objects on Same Line 2 30
CSS: Making responsive table look nicer 7 27
How can I implement a "Select All" with this configuration...? 6 42
alert(innerHTML); 8 18
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Viewers will learn how to use the Hootsuite Dashboard.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

809 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