StumbleUpon is a GREAT site for discovering other websites and promoting your own. They do have a couple ways to add sites and even have buttons of your own. But what if you want to automatically include a button but don’t want to edit the page each time? I’ve a little javascript to do such a thingRead More Below...
The code is rather simple and works in most browsers that have JavaScript enabled. <script type="text/javascript" language="javascript">
/* Image for stumble Logo */
var stumbleImage = 'stumbleit.gif'
/* Message after image */
var stumbleMessage='Stumble It!';
/* Target Window _blank for new */
var stumbleTarget='_blank';
/* no need to really edit below */
var stumbleURL= 'http://www.stumbleupon.com/submit?url=' + encodeURI(location.href) + '&title=' + encodeURI(document.title);
document.write('<a target ="'+ stumbleTarget +'" href="' + stumbleURL + '">');
if(stumbleImage.length>0) document.write ('<img border=0 src="'+ stumbleImage + '" alt="StumbleUpon Toolbar">');
if (stumbleMessage.length>0) document.write(stumbleMessage);
document.write('</a>');
</script>
Just copy the script in with the following modifications
If you don’t want an image make the linevar stumbleImage = 'stumbleit.gif'
Look likevar stumbleImage = ''
If you DO want an image make sure you upload it to your server and change var stumbleImage = 'stumbleit.gif' to be a URL to your image
If you don’t want text in the link make the linevar stumbleMessage='Stumble It!';
Look likevar stumbleMessage='';
Overall this SHOULD be a relatively painless process and get a link that works. Granted it will not work well with convoluted page titles but for the most part it’s pretty good. And here without much ado is the default button….
If you do have questions or comments let me know and I’ll see what I can do!
No user commented in " StumbleUpon Button "
Follow-up comment rss or Leave a Trackback