0

I'm a volunteer for an association, and we would like people to be able to put a badge on their site to show their support.

To keep things easy to manage, I was thinking of giving them a javascript function to paste on their site, which would call an url on our site, retrieving the image and showing it.

Would it be the right way to do it ?

If so, can you give me an example of code for the page on our side ?

Thank you

Bruno

3
  • Are you just asking how to create an img tag? Commented Oct 12, 2015 at 2:42
  • 1
    why don't you give them the link to the image? Commented Oct 12, 2015 at 2:46
  • Because I would like to be able to change the image without having to send it again to everyone. Commented Oct 12, 2015 at 15:58

1 Answer 1

1

You can just give them an image tag with a source that points to your server:

<img src="http://yourserver.com/image.jpg">

The user's browser will load the image from that source, regardless of what page/domain the user is on (as long as hotlinking and defenses against it are not an issue). No need for javascript.

Good luck!

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

2 Comments

If possible, please use protocol relative links. //yourserver.com/image.jpg
Actually, as I just wrote, I want to able to change the image loaded on every "supporter" site without having to send them anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.