me >> Tutorials >> Javascript tutorials

META for Automatic Page Forwarding

You can use <META …> to tell the web browser to automatically move to another web page after a specified period of time..This will be very useful when you move your website to a new address. To transfer a visitor to a new URL/address, place the following line between the HEAD tags :

<META HTTP-EQUIV="refresh" CONTENT="5;URL=http://www.newurl.com">

Here we gives two pieces of information:
CONTENT=5 means your browser waits for 5 seconds to reload and forward to  the new URL.

Automatic Page forwarding using Javascript
You can use a Javascript function to achieve the same task (without using the META TAG given above): 

function TransferToURL(){ 
window.location.href="http://www.newurl.com" 
}which is called by an onLoad in the BODY tag:<BODY onLoad="setTimeout('TransferToURL()',5000)">. 

Top 

 

Page contents: itechies.net – Learn how to tell the web browser to automatically move to another web page using Html.