Constructing a hyperlink to share content onto Facebook (Misc)
Nowadays, most sites will find that the majority of their traffic arrives as the result of someone else sharing or "likeing" the content on Social Media. As a result, it's desirable to make the act of sharing as easy as possible.
The various social networks often provide "share this" widgets that can be embedded into sites. However, these involve the user's browser requesting resources from the social network, and these requests are known to be data-mined in order to track users across the web and profile their browsing habits (to better sell ads).
However, most social media networks do make it possible to create a share button which works via a simply hyperlink.
This snippet details how to construct a link which shares a page onto Facebook. However, you'll first need to sign up for a developer account and create an App so that you have a valid Opengraph app id to include in the URL.
Details
- Language: Misc
Snippet
https://www.facebook.com/dialog/feed?app_id=<your_app_id>&link=<url>
Usage Example
https://www.facebook.com/dialog/feed?app_id=123456&link=https://www.bentasker.co.uk