Social Share and Like buttons without Javascript 4/10/15

By Chris Johnson

Social networks like Twitter and Facebook encourage you to drop external Javascript code on your website if you want those little share and like buttons you see everywhere. However, relying on external Javascript has a few downsides. For instance, you are:

Instead, you can use custom sharing links that don’t run any outside Javascript. If you go this route, you also get the benefit of being able to easily use custom text or button designs.

In each of the following examples, you’ll need to replace the YOUR-_____ in the HREFs with your own URL encoded content. If your pages are generated by server-side code, your programming language should have a URL encoding function that can help. Otherwise, there are online URL encoding tools you can use.

Twitter

<a href="https://twitter.com/intent/tweet?url=YOUR-URL&text=YOUR-TITLE&via=YOUR-TWITTERHANDLE">Twitter</a>

Facebook

<a href="https://facebook.com/sharer.php?u=YOUR-URL">Facebook</a>

LinkedIn

<a href="http://www.linkedin.com/shareArticle?mini=true&url=YOUR-URL&title=YOUR-TITLE&summary=YOUR-SUMMARY">LinkedIn</a>

Pinterest

<a href="http://pinterest.com/pin/create/button/?url=YOUR-URL&media=YOUR-IMAGE-URL&description=YOUR-DESCRIPTION">Pinterest</a>

Google+

<a href="https://plus.google.com/share?url=YOUR-URL">Google+</a>

I compiled this list with the help of a couple StackOverflow answers and Scott Hanselman’s post on the same subject.


  1. The Javascript will not only require more time to download, but it will use some of your visitor’s computing power to run. On desktop computers that might not be a big deal, but it could seriously slow mobile devices.