5 ms·
You can have a static button for "Share" on Facebook. I'm currently using static image buttons that allow you to Share on Facebook, Tweet on Twitter, Share on
by JohnTHaller 9y ago
You can have a static button for "Share" on Facebook. I'm currently using static image buttons that allow you to Share on Facebook, Tweet on Twitter, Share on Google+, Share on LinkedIn and Share on StumbleUpon (should probably remove that one) on my personal site: http://johnhaller.com/ http://johnhaller.com/
The code for Share on Facebook is (hoping HN doesn't mangle this):
<a href="https://www.facebook.com/" https://www.facebook.com/" onclick="windowpop('https://www.facebook.com/sharer/sharer.php?u=' https://www.facebook.com/sharer/sharer.php?u=', 500, 500); return false;" style="padding-right:15px;"><img src="/path/to/your/FacebookShareButton.png" width="57" height="20" alt="Share on Facebook" title="Share on Facebook"></a>
I've been using static social buttons for a while now on my personal site as well as PortableApps.com to improve page load speed and user privacy. I've been building web apps for 20 years since the original Active Server Pages 1.0 and 2.0, so there are few people more qualified than me to post this comment :)
- StavrosK 9y agoThank you, but you forgot to include the "windowpop" function :) I'd love it if I can replace both the Facebook button and GA on my site with something static, thanks. EDIT: Done, the URL is: https://www.facebook.com/sharer/sharer.php?u=<url> https://www.facebook.com/sharer/sharer.php?u=<url>
- JohnTHaller 9y agoAh, quite right, sorry... <script type='text/javascript'> function windowpop(url, width, height) { var leftPosition, topPosition; //Allow for borders. leftPosition = (window.screen.width / 2) - ((width / 2) + 10); //Allow for title and status bars. topPosition = (window.screen.height / 2) - ((height / 2) + 50); //Open the window. window.open(url+document.URL, "Window2", "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no"); }</script>
- StavrosK 9y agoThank you, unfortunately HN eats that. Here it is, better formatted: https://www.pastery.net/fwytsv/ https://www.pastery.net/fwytsv/
- badosu 9y agoYou can post content in verbatim by indenting it by 2 or more spaces (https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc)
- JohnTHaller 9y agoThanks, updated.
- skinnymuch 9y agoGenuine question since you mentioned probably removing StumbleUpon. Does anyone share with Google+?
- JohnTHaller 9y agoIt depends on your audience. There are more tech communities on Google+ than any other in my experience.
- skinnymuch 9y agoAh yeah for sure. I guess I was specifically asking for you. That's why I didn't want it sounding like I'm just dismissing Google+. If you don't want to share, that's fine.
- zichy 9y agoPop-ups? Don't be this guy.