Solved

Social Media Buttons

Posted on 2014-01-03
4
480 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
There are countless ways to use social media and often times businesses are not using it properly. Is your business making any social media mistakes? Here are some tips to get your foot in the door with social media and make the most of it for your …
The goal of the tutorial is to teach the user how to instant message and make a video call in Skype.
The goal of the tutorial is to teach the user what do the general settings mean under the preference tab in Skype.

821 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