How To Refresh a Page Automatically

Hello Guys Welcome to Coding Gurus Online Portal ...!

When you need your web page to be automatically refreshed for every 5 seconds or any second then, you can use this meta tag. It's a simple code, put it between the head tag on your web page.

You might have seen such pages in many websites and the very best example is your facebook news feed page, i.e. your home page of your facebook account, or your gmail inbox. The page displays the latest feed or update immediately it encounters one. But the fact is that it just keeps refreshing the page every few seconds thus updating the latest feed that comes in.

So here you have a code to make your very own website so very interactive and enterprising.

Using Meta Tag

This script is easy but powerful. Many websites use this script to refresh the same page, for example, my website updates in every 10 minutes and I want to show user my latest content then I put this script to my page and set it refreshs in every 10 minutes.


<meta http-equiv="refresh" content="2" >
// content = time in seconds.

Using Javascript

This is another script which refreshes a webpage, after the specified amount of time.Here we use JavaScript to do that, when we could accomplish the same thing using the meta tag also as defined above.


//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="0:30"
if (document.images){
var parselimit=limit.split(":")
function beginrefresh(){
if (!document.images)
if (parselimit==1)
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
curtime=cursec+" seconds left until page refresh!"