UI UX Design (36 Blogs)

Setting Cookies in HTML: All you Need to Know About

Last updated on Jun 21,2023 6.6K Views


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:

 

What are Cookies in HTML?

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.

Cookies-in-HTML

To overcome these cookies were created to store this information.

Unlock the power of UI/UX design with our UI UX Design Certification Course.

Working of Cookies

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.

The <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.

 

Cookies in HTML: Code

Example for redirecting current page to another page after 5 seconds:

&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
		&amp;lt;head&amp;gt;
			&amp;lt;title&amp;gt;Meta tags &amp;lt;/title&amp;gt;
			&amp;lt;meta name="keywords" content="HTML, Meta Tags, Metadata" /&amp;gt;
			&amp;lt;meta name="description" content="Learning about Meta Tags." /&amp;gt;
			&amp;lt;meta name="revised" content="tutorialpoint, 24/8/2019" /&amp;gt;
			&amp;lt;meta http-equiv="cookie" content="useri8d=xyz; expires=sunday, 24-Sep-19 3:59:59 GMT;" /&amp;gt;
			
			
		&amp;lt;/head&amp;gt;
		&amp;lt;body&amp;gt;
		

Style is done to this text.

		&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

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.

Find out our Flutter Course in Top Cities

IndiaOther Countries
Flutter Training in Chennai Flutter Course in Australia
Flutter Course in BangaloreFlutter Course in Canada
Flutter Training in HyderabadFlutter Course in London

Setting Author Name

&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
		&amp;lt;head&amp;gt;
			&amp;lt;title&amp;gt;Meta tags &amp;lt;/title&amp;gt;
			&amp;lt;meta name="keywords" content="HTML, Meta Tags, Metadata" /&amp;gt;
			&amp;lt;meta name="description" content="Learning about Meta Tags." /&amp;gt;
			&amp;lt;meta name="author" content="Avinash" /&amp;gt;
			
		&amp;lt;/head&amp;gt;
		&amp;lt;body&amp;gt;
		

Hello HTML5!

		&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

Enroll in a Flutter Development Course and gain the knowledge and confidence to build high-quality mobile apps on any platform.

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).

If you want to get trained in React and wish to develop interesting UI’s on your own, then check out the React JS Certification Course by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe.

Got a question for us? Please mention it in the comments section of “What is HTML?” and we will get back to you.

Comments
0 Comments

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

Setting Cookies in HTML: All you Need to Know About

edureka.co