Previous     Next

Automatically make an ‘Add to Blogger’ button for your Widgets

Since creating the Sudoku Google Gadget I’ve been going crazy building all kinds of widgets (so craaazy, that I have neglected this blog). One of the biggest hurdles getting the widgets ‘out there’ is that plenty of blog owners have no idea how to add the widget code to their blog. So lets make it easy for them. Lets just give them a ‘Add to Blogger’ button.

Blogger/Blogspot have actually done the hard work already, allowing widgets to be added by using either a GET or POST to a specific URL (More Details). All we have to do is come up with the correct form of the querystring and then wrap a button around it.

So that’s what I did.

Just enter the name and code for your widget in the top text boxes, press the Create button, and you get the code to add to your website. The code renders as a button, and we’re done. Easy!

To test it out, I took this HTML:

Get on down to <a href=''></a>

with the widget name ‘Test Widget’. Pressed the create button, and came up with:

<script type='text/javascript'> function AddToBlogger() { var sCode="undefined";self.location.href='' + sCode ;} </script> <input type='button' value='Add Test Widget to my blog' onClick='AddToBlogger()'>

And here is what it looks like:

If you liked this, then subscribe to my RSS feed

1 comment

  1. Джабир May 21

    Хотелось бы что-то наваять в комментах креативного, но мысль не складывается, так что просто “зачОт”