Angular Certification Training
- 16k Enrolled Learners
- Live Class
Cookies are a good way to make use of your previous data. In this article we will understand about Cookies in HTML in the following order:
These are the data stored in small text files on the computer. The cookies were invented to remember the information of the user. Because when a web server sends a website to the browser and if it by any external factors shuts down then the server forgets everything about the user.
When a user visits a web page his name will be stored in the cookie. If the same user visits the web page again then the web page remembers the user and provides related feeds related to the previously searched items. These cookies are exchanged between web browsers and web servers to keep track of different information based on the need of the web application. Cookies are saved in name-value pairs like:
username = Edureka don
When a browser requests a web page from a server, cookies belonging to the page are added to the request. This way the server gets the necessary data to “remember” information about users.
<meta> tag can be used to store cookies on this side of the client. These cookies are used by the server to keep track of the site visitor. Hence there will always be a pop up on some websites which ask you to its policy of using cookies.
Example for redirecting current page to another page after 5 seconds:
<!DOCTYPE html> <html> <head> <title>Meta tags </title> <meta name="keywords" content="HTML, Meta Tags, Metadata" /> <meta name="description" content="Learning about Meta Tags." /> <meta name="revised" content="tutorialpoint, 24/8/2019" /> <meta http-equiv="cookie" content="useri8d=xyz; expires=sunday, 24-Sep-19 3:59:59 GMT;" /> </head> <body> Style is done to this text. </body> </html>
If the expiration date and time is not included, the cookie is considered to be a session cookie and will be deleted soon after the user exits the browser.This is a type of temporary storage of information.
<!DOCTYPE html> <html> <head> <title>Meta tags </title> <meta name="keywords" content="HTML, Meta Tags, Metadata" /> <meta name="description" content="Learning about Meta Tags." /> <meta name="author" content="Avinash" /> </head> <body> Hello HTML5! </body> </html>
With this, we come to the end of this Cookies in HTML article. Check out the Web Development Certification Training by Edureka. Web Development Certification Training will help you learn how to create impressive websites using HTML5, CSS3, Twitter Bootstrap 3, jQuery and Google APIs and deploy it to Amazon Simple Storage Service(S3).
Got a question for us? Please mention it in the comments section of “What is HTML?” and we will get back to you.