Monday, March 24, 2008

Blogger how to - insert a script in blog - method 3

This post is the 3rd method to insert a script in your blog, as the first two methods were described here - 1 and here - 2.

As stated before - Warning: inserting anything, or modifying the xml template may destroy your blog, so be careful.
Backup your xml template every time you're modifying it, by clicking the "Download Full Template" link in the Layout -> Edit Html page of the blog admin area.

The 3rd method to insert a script in your blog is to insert the script code into a HTML page, as a blog widget.
In this manner, the xml template will not be put in danger.

To do so, go to the Layout section of the blog, then to "Page Elements".
In here, choose the positon of the widget (after or before the header, footer, into the sidebar, wherever) and select the "Add a page element" link.
Choose the "HTML/Javascript" widget and press "Add to blog".

In the next popup or windows which will be opened, insert the script code into the text area, between <script type="text/javascript"> and </script> tags.
In order to make this script invisible for the visitors (invisible means that the HTML widget will not be seen by the visitors, but it will be available in the blog and its code will run without problems), DON'T GIVE A TITLE TO THIS WIDGET.

The Blogger xml code in its default state will not display anything in the page which may reveal your script tricks if the html page doesn't have a title.
The script will be available in the page, although.

As an example, click onto the following picture and you may see a beautiful enlarge/fade effect.

example picture for an enlarge/fade effect