<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Append Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/append/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/append/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Wed, 13 Apr 2022 16:30:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Replace/Append Cookies in JavaScript</title>
		<link>https://www.scmgalaxy.com/tutorials/replace-append-cookies-in-javascript/</link>
					<comments>https://www.scmgalaxy.com/tutorials/replace-append-cookies-in-javascript/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Sat, 14 Aug 2021 12:56:29 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Append]]></category>
		<category><![CDATA[Cookies]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Replace]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7957</guid>

					<description><![CDATA[<p>Replace/Append Cookies When we assign a new cookie value to document.cookie, the current cookie is not replaced. The new cookie [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/replace-append-cookies-in-javascript/">Replace/Append Cookies in JavaScript</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><strong>Replace/Append Cookies</strong></h2>



<p class="wp-block-paragraph">When we assign a new cookie value to document.cookie, the current cookie is not replaced. The new cookie is parsed and its name-value pair is appended to the list. The exception is when you assign a new cookie with the same name (and same domain and path, if they exist) as a cookie that already exists. In this case, the old value is replaced with the new.</p>



<script src="https://gist.github.com/vijaypk376/446d251d1474e260e3353013eb9b8871.js"></script>



<script src="https://gist.github.com/vijaypk376/d6f9c779cd7e06d9db6bacafcefc4f7f.js"></script>



<h2 class="wp-block-heading"><strong>Reading Cookie</strong></h2>



<p class="wp-block-paragraph">We can read cookies by a document.cookie. The problem occurs when we need the specific part of the cookie to perform some action.</p>



<script src="https://gist.github.com/vijaypk376/1cd4305d71987896e26f5a77beaabb73.js"></script>



<h2 class="wp-block-heading"><strong>Deleting Cookies</strong></h2>



<p class="wp-block-paragraph">A cookie is deleted by setting a cookie with the same name (and domain and path, if they were set) with an expiration date in the past and if using max-age then must set a negative value.</p>



<p class="wp-block-paragraph">Ex: <strong>&#8211;</strong></p>



<script src="https://gist.github.com/vijaypk376/41404c6b09198948b4505ae95d4b4572.js"></script>



<h2 class="wp-block-heading"><strong>Updating Cookies</strong></h2>



<p class="wp-block-paragraph">A cookie is possible to update by setting a new value to a cookie with the same name.</p>



<script src="https://gist.github.com/vijaypk376/d2c0fe84f70231bd257c4ae0eef4bac0.js"></script>



<h2 class="wp-block-heading"><strong>Cookies Security Issues</strong></h2>



<ul class="wp-block-list"><li><strong>Can misuse Client Details</strong></li><li><strong>Can track User</strong></li><li><strong>Client Can Delete Cookies</strong></li><li><strong>Client can Manipulate Cookies</strong></li></ul>



<h2 class="wp-block-heading"><strong>Cookies Limitation</strong></h2>



<ul class="wp-block-list"><li><strong>Support HTML4 / HTML 5</strong></li><li><strong>Each cookie can contain 4kb Data</strong></li><li><strong>Cookies can be stored in Browser and server</strong></li><li><strong>It is sent with each request</strong></li></ul>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/replace-append-cookies-in-javascript/">Replace/Append Cookies in JavaScript</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/replace-append-cookies-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
