{"id":1448,"date":"2013-05-23T05:51:38","date_gmt":"2013-05-22T19:51:38","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=1448"},"modified":"2013-05-23T05:51:38","modified_gmt":"2013-05-22T19:51:38","slug":"javascript-cookies-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/javascript-cookies-primer-tutorial\/","title":{"rendered":"Javascript Cookies Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Javascript\/Cookies\/Cookies.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Javascript Cookies Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Javascript\/Cookies\/Javascript_Cookie_Primer.jpg\" title=\"Javascript Cookies Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Javascript Cookies Primer Tutorial<\/p><\/div>\n<p>In tutorial here we use Javascript code to illustrate some methods to utilize browser Cookies, as described by <a target=_blank title='Cookies' href='http:\/\/en.wikipedia.org\/wiki\/HTTP_cookie'>Wikipedia<\/a> below:<\/p>\n<blockquote><p>A cookie, also known as an HTTP cookie, web cookie, or browser cookie, is a small piece of data sent from a website and stored in a user&#8217;s web browser while a user is browsing a website. When the user browses the same website in the future, the data stored in the cookie can be retrieved by the website to notify the website of the user&#8217;s previous activity.[1] Cookies were designed to be a reliable mechanism for websites to remember the state of the website or activity the user had taken in the past. This can include clicking particular buttons, logging in, or a record of which pages were visited by the user even months or years ago.<\/p>\n<p>Although cookies cannot carry viruses, and cannot install malware on the host computer,[2] tracking cookies and especially third-party tracking cookies are commonly used as ways to compile long-term records of individuals&#8217; browsing histories \u2014 a major privacy concern that prompted European and US law makers to take action in 2011.[3][4] Cookies can also store passwords and forms a user has previously entered, such as a credit card number or an address. When a user accesses a Web site with a cookie function for the first time, a cookie is sent from server to the browser and stored with the browser in the local computer. Later when that user goes back to the same website, the website will recognize the user because of the stored cookie with the user&#8217;s information.[5]<\/p>\n<p>Other kinds of cookies perform essential functions in the modern Web. Perhaps most importantly, authentication cookies are the most common method used by web servers to know whether the user is logged in or not, and which account they are logged in under. Without such a mechanism, the site would not know whether to send a page containing sensitive information, or require the user to authenticate himself by logging in. The security of an authentication cookie generally depends on the security of the issuing website and the user&#8217;s web browser, and on whether the cookie data is encrypted. Security vulnerabilities may allow a cookie&#8217;s data to be read by a hacker, used to gain access to user data, or used to gain access (with the user&#8217;s credentials) to the website to which the cookie belongs (see cross-site scripting and cross-site request forgery for examples).[6]<\/p><\/blockquote>\n<p><iframe scrolling=\"no\" style=\"width:80%\" src=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/Cookiedom.html\"><\/iframe><\/p>\n<p>This Javascript Cookie usage Tutorial collects a Name from the web browser user via an HTML input tag in a form, and also tracks the number of times this web page has been visited using this browser and when that last visit was.<\/p>\n<p><a target=_blank href='http:\/\/www.rjmprogramming.com.au\/Javascript\/Cookies\/Cookies.html_GETME'>Download programming source code and rename to Cookies.html<\/a><\/p>\n<p>Regarding this Cookies <a target=_blank title='click picture' href='http:\/\/www.rjmprogramming.com.au\/Javascript\/Cookies\/Cookies.html'>topic<\/a> I really like <em>&#8220;JavaScript &amp; Ajax&#8221; seventh edition by Tom Negrino and Dori Smith<\/em> <\/p>\n<p><strong><em>Did you know &#8230;<\/em><\/strong><br \/>\nJavaScript makes a great easy-access Calculator?<\/p>\n<p>Try typing the lines below into the address bar of your favourite browser:<\/p>\n<p>Javascript: eval(512 \/ 380);<br \/>\nJavascript: eval(512 * 380);<br \/>\nJavascript: eval(512 &#8211; 380);<br \/>\nJavascript: eval(512 + 380);<br \/>\nJavascript: eval(512 % 380);<\/p>\n<p>These days we spend so much time on the Internet it is a much quicker way to get to a calculator!\n<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d1448' onclick='var dv=document.getElementById(\"d1448\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=Javascript\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d1448' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In tutorial here we use Javascript code to illustrate some methods to utilize browser Cookies, as described by Wikipedia below: A cookie, also known as an HTTP cookie, web cookie, or browser cookie, is a small piece of data sent &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/javascript-cookies-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[264,652,997,1319],"class_list":["post-1448","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-cookies","tag-javascript","tag-programming","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/1448"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=1448"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/1448\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=1448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=1448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=1448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}