--> How To Control Browser Cache And Cookies With HTML? | Experience Lab - Online business creation and development guide for bloggers and startups

How To Control Browser Cache And Cookies With HTML?

Caching and cookies are two methods browsers employ to save data regarding a certain website. Caching is used to store some web page data lo...



Control browser caching and cookies with HTML

Caching and cookies are two methods browsers employ to save data regarding a certain website. Caching is used to store some web page data locally for faster loading on each subsequent revisit, whereas cookies are small pieces of data containing important user information for a website. Not many webmasters know or use this, but you can actually use just HTML meta tags to control cookies and browser caching for your website!


Meta Tags are used to store pieces of information on a web page. Essentially, it is information about data, and its purpose is for browsers and search engines to understand and know the page better.


Disabling cache



When you visit a webpage, your browser stores it in its cache so as to make reloading faster. Sometimes, cache errors cause the browser to load an older version of a page, even when new content is available. To prevent this, you can simply disable browser cache from time to time by using some meta tags. Here's what you can do.



<meta http-equiv="Cache-Control" content="no-store" />  



This meta tag is recognized in Firefox, Chrome, and Internet Explorer. Even more so in IE, where you can use more values and specifications to disable caching, as follows.



<meta http-equiv="Cache-Control" content="no-cache" />


<meta http-equiv="Pragma" content="no-cache" />



You can also set an expiration date to ensure that the browser will show the file that’s fresh from the server, rather than from the cache.



<meta http-equiv="expires" content="Fri, 18 Jul 2014 1:00:00 GMT" />  



The document expires after the specified date and time. "0" means the browser has to check for a fresh document on each visit.


How to set cookies?



Cookies are small files stored on your browser that contain important user information, such as user and password. Websites may reuse the cookies to tailor some functionality. For example when you shop in an online store, as long as you have not yet checked out, the items remain in your cart even though you have left the browser for several days.





Here's the tag for setting a cookie;



<meta http-equiv="Set-Cookie" content="name=data; path=path; expires=Day, DD-MMM-YY HH:MM:SS ZONE">



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. Here is a an example cookie that will expire at the end of this year;


<meta http-equiv="Set-Cookie" content="name=data; path=path; expires=Thursday, 01-Jan-2015 00:00:00 GMT">


Got any more useful HTML tricks you can share with us? Let us know in the comments section below!

COMMENTS

Name

Affiliate Marketing,12,Announcement,34,Bing,9,Bitcoin,38,blog,7,Blogger Resources,42,Blogger Templates,4,blogger tricks,156,Blogging ethics,70,Blogging tips,198,Bugs and Errors,34,Business,9,Copyright Violation,9,CSS and HTMLTricks,95,Designs,8,drop down menu,7,eBook,12,Email Marketing,7,Events,30,Facebook,30,Facebook tricks,49,Google,157,Google AdSense,42,Google Analytics,7,Google Plus,51,Google Plus Tricks,38,Guest Posts,112,home,2,How To,77,Internet,1,JSON Feeds,25,Kitchen Recipes,2,Label Based Sitemap Themes,1,Make Money Online,108,Marketing,16,MBT Blogger Templates,7,Menus,1,News,146,Pages,1,Posts,10,presentations,15,Responsive,10,Reviews,7,SEO,307,Settings,6,Shortcode,15,Sitemap Themes,1,Social Media,155,Technology,7,Templates,1,Tips,2,Tools,1,Traffic Tips,80,Video,19,Web Designing,62,web hosting,18,Webmaster Tools,97,Widgets,199,wordpress,26,
ltr
item
Experience Lab - Online business creation and development guide for bloggers and startups: How To Control Browser Cache And Cookies With HTML?
How To Control Browser Cache And Cookies With HTML?
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5ueab7ZQW7UMsYMP_6T6GZVl2rrjBw-okLRKu4HWi1zH6ziZo_Z2g2gOTmP93Ugjsd0YyFhC-60O9n1bop7_Pd3vkxaTtHJjE6x5u1AhqcVk1_0hwCpVW0A1rSxYQbBboujOs1V1wp8aJ/s1600/caching+and+cookies.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5ueab7ZQW7UMsYMP_6T6GZVl2rrjBw-okLRKu4HWi1zH6ziZo_Z2g2gOTmP93Ugjsd0YyFhC-60O9n1bop7_Pd3vkxaTtHJjE6x5u1AhqcVk1_0hwCpVW0A1rSxYQbBboujOs1V1wp8aJ/s72-c/caching+and+cookies.jpg
Experience Lab - Online business creation and development guide for bloggers and startups
https://www.experiencelab.info/2014/11/how-to-control-browser-cache-and.html
https://www.experiencelab.info/
https://www.experiencelab.info/
https://www.experiencelab.info/2014/11/how-to-control-browser-cache-and.html
true
2959477579779989044
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share. STEP 2: Click the link you shared to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy