Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Social media sharing without scripts

Tags:

php

I want to share a webpage with social media. I do not want to use plugins, or add JS scripts if I can help it. I just want to use a link in each case.

I have found a page which explains how to share a webpage in facebook with a link;

<a href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fhuebris.com%2Ffacebook-share-button&t=How+to+Share+Content+from+Your+Website+on+Facebook" target="_blank">this link</a>

I have also found how to share on google+ with a link;

<a href="https://plus.google.com/share?url=' . $url . '" ...

However, I am looking how to share a page to

  • LinkedIn
  • Pinterest
  • Twitter

as well, but I am coming up short. There seem to be guides on copy/pasting scripts for the share buttons, as well as guides on using each respective API, but for something so simple as using links to post, I cannot seem to find much at all.

like image 425
myol Avatar asked Feb 16 '15 18:02

myol


People also ask

How do I create a social share button?

To generate a Facebook Share Button, visit https://developers.facebook.com/docs/plugins/share-button and specify the URL you want people to share as well as the width. Then generate the code, and paste it into your site where you want the button to appear.

What is social link example?

A Tweet, Facebook status update or Pinterest pin that includes a link to the content being promoted are all examples of social links. Social shares with links = social links.


1 Answers

Please have a look into these sharing links which works great without javascript for various social sites.

<!-- Facebook -->
<a href="http://www.facebook.com/sharer.php?u=http://www.example.com" target="_blank">Share to FaceBook</a>

<!-- Twitter -->
<a href="http://twitter.com/share?url=http://www.example.com&text=Simple Share Buttons&hashtags=simplesharebuttons" target="_blank">Twitter</a>

<!-- Google+ -->
<a href="https://plus.google.com/share?url=http://www.example.com" target="_blank">Google+</a>

<!-- Digg -->
<a href="http://www.digg.com/submit?url=http://www.example.com" target="_blank">Digg</a>

<!-- Reddit -->
<a href="http://reddit.com/submit?url=http://www.example.com&title=Simple Share Buttons" target="_blank">Reddit</a>

<!-- LinkedIn -->
<a href="http://www.linkedin.com/shareArticle?mini=true&url=http://www.example.com" target="_blank">LinkedIn</a>

<!-- Pinterest -->
<a href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());">Pinterest</a>

<!-- StumbleUpon-->
<a href="http://www.stumbleupon.com/submit?url=http://www.example.com&title=Simple Share Buttons" target="_blank">StumbleUpon</a>

<!-- Email -->
<a href="mailto:?Subject=Simple Share Buttons&Body=I%20saw%20this%20and%20thought%20of%20you!%20 http://www.example.com">Email</a>

Update I didn't test this href for pinterest, let me know if works or not.

<!-- Pinterest -->
<a href="http://pinterest.com/pin/create/button/?url={URI-encoded URL of the page to pin}&media={URI-encoded URL of the image to pin}&description={optional URI-encoded description}" class="pin-it-button" count-layout="horizontal">
    <img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />
</a>
like image 187
Safoor Safdar Avatar answered Sep 19 '22 11:09

Safoor Safdar