2

I'd like to be able to have the stumbleupon button on all my site pages, but always have it "Stumble" my home page. How can I add this functionality to the Button?

Here's what Stumbleupon gives me:

< !-- Place this tag where you want the su badge to render -->

< su:badge layout="5" >< /su:badge >

< !-- Place this snippet wherever appropriate -->

< script type="text/javascript"><br>
  (function() {
    var li = document.createElement('script'); li.type = 'text/javascript'; li.async = true;
    li.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + '//platform.stumbleupon.com/1/widgets.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(li, s);
  })();
< /script>

Here's my site fairivy.com

Thank you!

nickhar
  • 19,981
  • 12
  • 60
  • 73
user1803660
  • 81
  • 1
  • 1
  • 3

2 Answers2

2

Where you want the badge to show, edit the code from this:

    <su:badge layout="5"></su:badge>

To this:

    <su:badge layout="5" location="http://www.fairivy.com/"></su:badge>
1

you may have to customize that js script that stumblupon provides, try changing this line in the JS, and have it hosted on your own website:

if(this.type=='follow')
return scheme+'www.'+ this.domain+ followBase+'?id='+ this.ref+'&l='+ this.layout;else if(this.type=='bestof')
return scheme+'www.'+ this.domain+ bestofBase+'?'+ this.request.join('&')+'&l='+ this.layout+'&title='+ encodeURIComponent(this.title);

if you use this solution you may have to make a seperate .js with only your main domain.

you would also need to change this line to your custom location:

'//platform.stumbleupon.com/1/widgets.js'
Ariosa
  • 45
  • 7
  • copy the whole javascript file, replace the "this.domain+followBase+'?id='" and "this.domain+ bestofBase+'?'" with simply : "fairivy.com" – Ariosa Nov 06 '12 at 17:10
  • Sorry for being thick, but I'm not even a little bit of a programmer. I tried what you mentioned but the button disappeared. I don't think I entered it correctly :( – user1803660 Nov 06 '12 at 19:44