Pub Pixel Avatar Image

HTML5 Snippets - Redirecting Your Web Page

Published:

Rate Article (Sign in and be the first to rate this article.)

Article Details

Views: 778

First Published:

Word Count: 436

Edition: 1

Now if you need to redirect your users from the current web page they are on to another web page or web site simply include the <meta> element along with the http-equiv attribute and content attribute. You will then need to include the refresh value for the http-equiv attribute in-order to tell the browser that it should refresh in-order to redirect your web page. Next you will need to include the content attribute. The content attributes value should first include a number which will tell the browser how many seconds until the current page redirects to a new web page or web site, for example, a value of ("30") will tell the browser to redirect the current web page in thirty seconds. You will then need to place a semicolon (";") right after the number of seconds stating when the current web page is to be redirected which is then followed by a space that is then followed by the string ("url=") that is followed by the desired URL value you want the the current web page to redirect to.

Now let me first show you the code by itself for the HTML snippet for redirecting your web page. And then I will show you how to code and where to place the HTML snippet for both HTML5 and XHTML5.

Here is the HTML code snippet below to redirect your web page to the URL ("http://www.example.com/") in 5 minutes.


<meta http-equiv="refresh" content="300; url=http://www.example.com/" />

Here is the HTML code snippet for redirecting your web page for HTML5 in the example below.


<!DOCTYPE html>
<html>
<head>
 <meta charset="UTF-8">
 <meta http-equiv="refresh" content="300; url=http://www.example.com/">
 <title>Welcome To HTML5</title>
</head>
<body>
  
 <p>This web page will redirect in 5 minutes to the following web site example.com.</p>  

</body>
</html>

And here is the HTML code snippet for redirecting your web page for XHTML5 in the example below.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">  
<head>
 <meta charset="UTF-8" />
 <meta http-equiv="refresh" content="300; url=http://www.example.com/" />
 <title>Welcome To XHTML5</title>
</head>
<body>

 <p>This web page will redirect in 5 minutes to the following web site example.com.</p>  

</body>
</html>

Article Tags

Tag Article (Sign in if you want to tag this article.)

Share This Article

Send To Facebook Link

Tweet This Link

Send To LinkedIn Link

Send To StumbleUpon Link

Digg This Link

Send To Google Plus One Share Link

Send To Reddit Link

Send To Tumblr Link

Send To Delicious Link

Send To FriendFeed Link

Send To Diigo Link

Email Link

AddThis Link

0 Comments

Leave Comment (Sign in and be the first to comment on this article.)

Important

This site cannot guarantee the accuracy of articles, comments, answers and other types of content or media submitted by members or anonymous users and guests, and we recommend that you use common sense when following any advice or information found on this site. Read our full Content Disclaimer Agreement for further information.