Refresh a Page Using JavaScript or Meta Tags

Manage page refresh using JavaScript and HTML meta tags. Usually chat systems and live scores and hospitals where data generate and refresh. This tags usage is normally used using HTML and JavaScript.

Share

I will try to convey an idea on how to refresh a page using JavaScript or Meta Tags. Refreshing a page isn’t necessary but some time you will need a to refresh a page after some seconds or minute. Specially when you are working on those applications which needs page refresh. Like Games Websites, an special examples for ESPN Sport. Where these types of refresh uses go through them once.

  • Chat applications and websites.
  • Hospital managements system.
  • Railway reservations and train reservations system.
  • Live TV channels websites.

Those are some examples of websites which may be use refresh a page technique.

Refresh a Page – JavaScript Method

<script type="text/javascript">
var timer = null;
function auto_reload()
{
    window.location = 'http://domain.com/page.php';
}
</script>

Use the above code with body tag. Execute onLoad event so your function loads when page opens.

<!-- Below line will refresh page after 10 seconds. -->
     <body onload="timer = setTimeout('auto_reload()',10000);">

Change 10000 to desired value 10000=10 seconds.

Meta Tag Method

To refresh the page using meta tag use the following single line of code. This will refresh page after 30 seconds.

<head>
<meta http-equiv="refresh" content="30" />
</head>

Some time JavaScript Disabled so you have to use meta tags in order to refresh the page. This is the simple tutorial on How to Refresh a Page Using JavaScript or Meta Tags.

People Also Read: Add Auto Refresh in Blogger.

Leave a Reply

Your email address will not be published. Required fields are marked *