As a web designer or web developer, you must have applied meta tags at various places like keywords, descriptions, and titles. But in this blog, we are going to tell you 4 useful things which you can do with meta tags.
1) Browser Cache
Browser cache has the advantage that it stores everything in its cache from the webpages and renders the website much faster when the users visit the same website subsequently. However, it has a disadvantage as well. It will not let the users see the updates/changes easily that were made to the website recently. Therefore, if your website speed is optimized enough, you can stop browsers to store your web pages in their cache by simply using one-liner code as shown below:
This meta tag is recognized in Firefox, Chrome, and Internet Explorer.
2) Setting Cookies
Similar to cache, cookies also store some of the users’ information in the browser and display them to the users on their next visits. For eg., if you attempt to buy any product online and you don’t checkout to pay. The order will be saved in your cart and will be visible to you even if you visit the same website after a few days. This is done with the help of storing users’ actions in the cookies. Below is a one-line code to enable cookies in the browser of users:
In the above code snippet,’name=data’ is the name of the cookies which determines the values set in it. the path is the path of the document & the value of expiration indicates the time and date when cookies are deleted from your computer.
3) Web Page Refresh
Often, there arises a situation where the web developer needs to refresh the page frequently for eg. in a case where the webpage has to fetch the current values of stock, currency, etc. There is a one-line code to do this:
The above code will refresh the web page after every 5 seconds.
4) Page Redirection
This is one of the situations which almost every web designer and web developer have to face. Some clients want their web pages to be redirected to another page after a couple of seconds or immediately on load. This shortcode will help the web designers to perform this request:
In this code, the content=”5″ states that after 5 seconds the web page will be redirected to URL ‘http://example.com/’