A simple “Share on Facebook” link

A simple solution to a simple approach. This fits best for smaller sites and not blogs. See a working example at http://www.ahotpizza.ca.

“http://www.facebook.com/sharer.php”, with parameters “u” and “t”

The URL format is as follows (giving the example of google.com, wrapping for ease of viewing):

http://www.facebook.com/sharer.php
?u=http%3A%2F%2Fwww.google.com%2F
&t=Google+Best+Search+Engine

With wrapping removed, the above code looks like this:

http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.google.com%2F&t=Google+Best+Search+Engine

The parameters are “u”, which gives the URL of the page (encoded, of course), and “t”, which gives the default title of the link (also encoded). So this particular example could be used to let somebody create a “Share” on Facebook, with the URL “http://www.google.com” and the default title “Google Best Search Engine”.

The “t” parameter is more for precaution because Facebook gets the title from the page and displays it. However, if Facebook is unable to reach the page, then it will use the “t” parameter instead. So you’ll probably want to provide a “t” just in case there is a network problem when Facebook tries to connect.

Similar Articles

  1. How to Create a Multi-link Javascript Jump Box
  2. Ten Important SEO Tips
  3. Simple Website Redirections
  4. Clear Text Box When Clicking on It
  5. WordPress Popular Snippets
  6. Ten Fixes For Faster Loading Webpages
  7. Style Sheet Switcher Script

Hosting Encyclopedia