Creating a custom sharing service

Posted by on Jan 15, 2016 in Code Chat, JavaScript | No Comments
Creating a custom sharing service

This is possibly an example of a pun which has gotten out of hand. It began when I was setting up some sharing buttons on a blog using the service sharethis.com.

I couldn’t help thinking how funny it would be to have a similar service called “Cher This” which somehow allowed you to share a link with your friends through the voice of Cher.

I was also interested in seeing whether I could set up a proof-of-concept service which would emulate the experience of sharethis.com, so I hacked this demo together and I’m quite pleased about how it’s turned out.

Cross domain javascript

The javascript is written without any libraries so that it can be included on any page without dependencies. I’ve also set up the required headers to allow cross-domain javascript calls. I’m sure this isn’t going to get used widely, but in theory anyone could include this service on their site.

Facebook sharing

The widget makes a call to the Facebook API via the sharing dialog, the callback URL which follows a share allows me to count each successful share.

Customised images

The API call sends an image path which is actually a PHP script that dynamically creates a composite of a Cher graphic and the open graph image tag included on the target page.

Demo

The working demo page allows you to either share a specific URL, or include the widget on your page so your visitors can Cher that page.

Check out the Cher This demo

Cher this page

Alternately, here’s the widget in use so you can Cher This Page:

 

Leave a Reply