1. Put in a widget
Most of my hacks use this method. I like this method because it’s easier to install, uninstall and you don’t need to mess with your template code.
Then place the whole thing before the
But Google Sites, like most free host doesn’t accept javascripts. Luckily there is a workaround -change the javascript file into a text file, by changing the file extension from .js to .txt.
Note: The external script must not contain the
After uploading the file to Google Sites, get the direct link to the file and use it in the code below (notice the .txt file extension).
The direct link to the file will begin with
This code must be positioned exactly where you would want the script to be in your template.
Enjoy!
<script type='text/javascript'>
put javascript code in here
</script>
2. Put it in the template itself
Use this method if the script is accessed from outside of a widget or from more than one places in your template. Do it like this:<script type='text/javascript'>
//<![CDATA[
put javascript code here
//]]>
</script>
</head>
tag in your template.3. Host the javascript file externally (outside of Blogger server)
To be specific use Google Sites. Why Google Sites? Because it’s free first and foremost (that’s why you join Blogger in the first place right?) and it’s a part of Google big family, so you don’t have to sign up or anything.But Google Sites, like most free host doesn’t accept javascripts. Luckily there is a workaround -change the javascript file into a text file, by changing the file extension from .js to .txt.
Note: The external script must not contain the
<script type='text/javascript'></script>
tags.After uploading the file to Google Sites, get the direct link to the file and use it in the code below (notice the .txt file extension).
1 | < script src = 'filename.txt' type="text/javascript'/> |
https
. To make it work, you need to change https
to http
when adding to the code, like in this example:1 | < script src = 'http://sites.google.com/site/bloggersentral/file-storage/shBrushXml.txt' type = 'text/javascript' /> |
Enjoy!
0 comments:
Post a Comment