Facebook sharer with location.hostname

Hello,

I’m creating a simple site that will be copied to several domains. The site contains a custom Facebook sharer link, and I want to avoid having to modify the link for each of the domains. It should take “current” web address somehow.

As far as I can figure out, I’m trying to combine these two pieces of the puzzle:

<A HREF=“http://www.facebook.com/share.php?u=ADDRESS_TO_SHARE&title=Some Title” target=“_blank”><img src=“image.png” /></A>

&

location.hostname

Or any other solution that doesn’t involve third party plugins.

Help would be very much appreciated!

Hi dunementat,

One more option is:

<A HREF=“http://www.facebook.com/share.php?u=&lt;?php echo $_SERVER[‘SERVER_NAME’] ?>&title=Some Title” target=“_blank”><img src=“image.png” /></A>

Thank a lot!

That’s exactly what I was looking for (just didn’t know it).