1

How do I create share buttons with custom images that share the current link of the webpage? It only shares a fixed link

2 Answers 2

1

did you try using add this

i think you can customize the pic they are using.

here different-image

Sign up to request clarification or add additional context in comments.

Comments

0

If you're talking about standard social icons, presumably of which you have an icon set you like. Then it's safe to assume it's up to you to ensure the URL passed to the sharing URL is the one that you wish to allow users to be able to share.

There are a number of ways you could do this, server-side would be best- assuming you're already using some sort of server-side scripting language; in PHP for example something along the lines of:

<a href="http://facebook.com/share?url=<?php echo $_SERVER['PHP_SELF'] ?>"> <img/> </a> 

If you're not you could use JavaScript but obviously, be aware that non-js users would get the static URL that you'd presumably default to the homepage.

An example of this using jQuery would be something along the lines of:

$("a").attr('href', 'http://faceboom.com/share?url=' + window.location); 

Note: I completely made up that Facebook share URL.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.