Page refresh and redirect through meta tags

We can refresh a page at a particular interval by using Meta refresh tags within the head area of a page. User doesn't have any control over the refresh rate of the page. This is usually used where page content changes over time. A page showing the cricket score has to refresh itself to display the current score. So at a particular interval the page reloads by meta refresh tag and collects the fresh score from the server. Here is the basic command used to refresh a page.

<meta http-equiv="Refresh" content="15">

Here the page will refresh after every 15 seconds.

Redirecting using meta refresh tags

We can use the same technique of refresh to redirect the page to a new location or a URL. Here by changing the time we can control the duration for which the current page will stay or load before the redirection takes place to new URL. Here is the code.

<meta http-equiv="Refresh" content="15;URL=https://www.google.com">

Here the page will redirect to google.com after loading for 15 seconds.

This type of meta redirection is different than header redirection. In a header redirection browser does not load the source page so it has no effect on header information the browser already have.

Page refresh by using button

In addition to automatic refresh by meta tag, we can give a button which can be used by visitors to refresh the page before the meta refresh takes effect.

<input type=button onClick="location.href='refresh.php'" value='click here to refresh this page'>:


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com




    Post your comments , suggestion , error , requirements etc here .




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2023 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer