开发者

How does one get about making a dynamic web badge using client side javascript?

开发者 https://www.devze.com 2022-12-28 07:34 出处:网络
For example we want to be able to give our vendors javascript code and once embedded, it would show a badge on their site开发者_如何学Go and show how long they have been doing business with us.

For example we want to be able to give our vendors javascript code and once embedded, it would show a badge on their site开发者_如何学Go and show how long they have been doing business with us.

Thank You


It shouldnt be too hard.

I recommend providing a link to an dynamic image with a querystring that contains their vendor id. The server would then render a badge with their specific details on it eg

<img src='http://www.x.com/vendor.gif.aspx?id=123' style='width:50px; height:50px'/>

This will be much easier for you to implement and much easier for the vendors to integrate. It will also work for users without JavaScript enabled.


Have a look at existing badges. Typically you'll find some custom javascript code and some URL, which points to a web service (on your site) publishing the desired data.

Here's an example from twitter:

<script src="http://twitter.com/javascripts/blogger.js" type="text/javascript">
<!--mce:0-></script>

<script src="http://twitter.com/statuses/user_timeline/HanSolo.json?   
   callback=twitterCallback2&amp;count=5" type="text/javascript">
   <!--mce:1--></script>

If your data is somewhat static, you might be well served with just an image tag (as proposed by James Westgate).

0

精彩评论

暂无评论...
验证码 换一张
取 消