How to Auto Refresh your Blogspot or any other site for that matter?
We will see the code to on how to install and make the Blogger site auto refresh by itself, set an interval for auto refresh using HTML and JavaScript and allow your users to refresh the page by giving them a button.
Without wasting any more time, we will go to the installation:
Using HTML:
1. Go to Template > Edit HTML
2. Search for the <meta
Once you are in the line starting with <meta and ending with />
Paste the following code after or before that line
<meta http-equiv="refresh" content="2"/>
This is going to refresh the Blogger site every 2 Seconds, You can change it according to your needs to any value.
You are done! Save the template and exit.
Using JavaScript:
1. Go to Template > Edit HTML
2. Find (Ctrl+F) for </head>
Replace it with the following code:
<script type='text/JavaScript'>
function timedRefresh(timeoutPeriod) {
setTimeout("location.reload(true);",timeoutPeriod);
}
</script>
</head>
3. Now find for <body>
Replace it with the following code:
4. Save the template. You are done! Check it out.
Customization:
JavaScript:timedRefresh(3000) indicates that the page will refresh every 3 seconds.
To make it refresh every 4 seconds then replace it with 4000 and so on.
Using JavaScript with User Control:
1. Go to Layout > Add a Gadget > Choose "HTML/JavaScript" gadget.
2. Paste the following small code in the gadget:
3. Save the gadget you are done! Demo for User controlled Refresh
Note: The above code can be placed anywhere you like on Blogger including posts HTML part.
0 comments:
Post a Comment