What You Should Know About HTML Meta Tags

HTML <meta> tags are very important but many web designers have failed to make use of its robust functionalists, most web developers only make use of it for page description, author, or to list keywords.

HTML <meta> tag can be use to store data on a web page for browsers and search engines, <meta> tags are not displayed on the page.

The following important ways you can make use of HTML meta tags on your webpage.

1. For Redirecting a Page

Page redirect can be done client-side with plain HTML without JavaScript, the code below will redirect you to the page http://awilabs.com. Note the the content=”0″ means the page will redirect after 0 seconds of loading, so if for example you want a particular page to redirect to another page after 10 seconds then you will have content=”10″.

Also note that the below code MUST be inbetween the head tags <head>…..</head>

2. For Controlling Browser Cache

Cache can very very helpful to making pages loads very fast, pages you have previously visited get stored in cache so when next you visit same page, the page doesnt have to request same content again from the server, but this can be an issue when you have updated your page and still some old visitors are still being served the old content.
You can turn off cache or manipulate it using meta tags.

a. to turn off cache:

For backwards compatibility with HTTP/1.0 developers should add:

b. to set expiring date:
this is use to set an expiring date when the content is flagged expired and a new request to the server should be make.

The above code means after the set date in content=”” the page should use cache again but rather request a fresh content from the server and if you tpe in content=”0″ that means the page should always request for a fresh content.

3. For Refreshing Web Pages

Similar to using meta tags to redirect to another page, it can also be used to refresh same page after a certain time. see below code:

this means the page will keep refreshing after 5 seconds.

4. For Page Transition

In Microsoft Internet Explorer 5.5 and above, you can add transition effects like that on PowerPoint slideshows where you can specify transition effects from one page to another.
Note: Transitions are not supported by all browsers, and are therefor often considered as bad design.

The above code performs a random-dissolve transition for 2 seconds upon entering a page.

Where the above performs a transition effect on page exit for 1 second

5. For Setting Cookies

Similar to cache, cookies is a small piece of data that is stored in the browser by the websites you’ve visited. Websites may reuse the cookies to tailor some website functionalities. A real everyday example is when you shop in an online store. If you’ve added a few items to the basket, as long as you have not yet checked out, the items will remain in the basket even though you have left the browser for several days.

To set cookies on meta-tag you can use:

name=data is the name of the cookies which determines the values set in it. path is the path of document. Whereas, the value of expired indicates the time and date when cookies are deleted from your computer. If you leave the expired date empty, the cookies will be deleted once you quit the browser.

 

Leave a Reply

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