Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / api / Ext.util.Cookies.html
1 <!DOCTYPE html><html><head><title>Ext.util.Cookies | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
2 <style type="text/css">.head-band { display: none; }
3 .header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
4 .doc-tab .members .member a.more { background-color: #efefef; }
5 </style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
6 </head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
7 <a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
8
9     req = {
10         liveURL: '.',
11         standAloneMode: true,
12         origDocClass: 'Ext.util.Cookies',
13         docClass: 'Ext.util.Cookies',
14         docReq: 'Ext.util.Cookies',
15         version: '4.0',
16         baseURL: '.',
17         baseDocURL: '.',
18         baseProdURL: '.'
19     };
20
21     clsInfo = {};
22
23
24
25 </script>
26
27 <script type="text/javascript" src="../search.js"></script>
28 <!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
29 <script type="text/javascript" src="../class_tree.js"></script>
30 <script type="text/javascript" src="../class_doc.js"></script>
31 <script type="text/javascript">
32     req.source = 'Cookies.html#Ext-util.Cookies';
33     clsInfo = {"methods":["clear","get","set"],"cfgs":[],"properties":[],"events":[],"subclasses":[]};
34     Ext.onReady(function() {
35         Ext.create('Docs.classPanel');
36     });
37 </script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Cookies.html#Ext-util.Cookies" target="_blank">Ext.util.Cookies</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>Utility class for setting/reading values from browser cookies.
38 Values can be written using the <a href="Ext.util.Cookies.html#set" rel="Ext.util.Cookies#set" class="docClass">set</a> method.
39 Values can be read using the <a href="Ext.util.Cookies.html#get" rel="Ext.util.Cookies#get" class="docClass">get</a> method.
40 A cookie can be invalidated on the client machine using the <a href="Ext.util.Cookies.html#clear" rel="Ext.util.Cookies#clear" class="docClass">clear</a> method.</p>
41 <div class="members"><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-clear" class="member f ni"><a href="Ext.util.Cookies.html#method-clear" rel="method-clear" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Cookies.html" class="definedIn docClass">Ext.util.Cookies</a><br/><a href="../source/Cookies.html#Ext-util.Cookies-method-clear" class="viewSource">view source</a></div><a name="clear"></a><a name="method-clear"></a><a href="Ext.util.Cookies.html#" rel="method-clear" class="cls expand">clear</a>(
42 <span class="pre">String name, [String path]</span>)
43  : void</div><div class="description"><div class="short">Removes a cookie with the provided name from the browser
44 if found by setting its expiration date to sometime in the p...</div><div class="long"><p>Removes a cookie with the provided name from the browser
45 if found by setting its expiration date to sometime in the past.</p>
46 <h3 class="pa">Parameters</h3><ul><li><span class="pre">name</span> : String<div class="sub-desc"><p>The name of the cookie to remove</p>
47 </div></li><li><span class="pre">path</span> : String<div class="sub-desc"><p>(optional) The path for the cookie. This must be included if you included a path while setting the cookie.</p>
48 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
49 </li></ul></div></div></div><div id="method-get" class="member ni"><a href="Ext.util.Cookies.html#method-get" rel="method-get" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Cookies.html" class="definedIn docClass">Ext.util.Cookies</a><br/><a href="../source/Cookies.html#Ext-util.Cookies-method-get" class="viewSource">view source</a></div><a name="get"></a><a name="method-get"></a><a href="Ext.util.Cookies.html#" rel="method-get" class="cls expand">get</a>(
50 <span class="pre">String name</span>)
51  : Mixed</div><div class="description"><div class="short">Retrieves cookies that are accessible by the current page. If a cookie
52 does not exist, get() returns null.  The follo...</div><div class="long"><p>Retrieves cookies that are accessible by the current page. If a cookie
53 does not exist, <code>get()</code> returns <tt>null</tt>.  The following
54 example retrieves the cookie called "valid" and stores the String value
55 in the variable <tt>validStatus</tt>.</p>
56
57 <pre><code>var validStatus = Ext.util.Cookies.get("valid");
58 </code></pre>
59
60 <h3 class="pa">Parameters</h3><ul><li><span class="pre">name</span> : String<div class="sub-desc"><p>The name of the cookie to get</p>
61 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;<p>Returns the cookie value for the specified name;
62 null if the cookie name does not exist.</p>
63 </li></ul></div></div></div><div id="method-set" class="member ni"><a href="Ext.util.Cookies.html#method-set" rel="method-set" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Cookies.html" class="definedIn docClass">Ext.util.Cookies</a><br/><a href="../source/Cookies.html#Ext-util.Cookies-method-set" class="viewSource">view source</a></div><a name="set"></a><a name="method-set"></a><a href="Ext.util.Cookies.html#" rel="method-set" class="cls expand">set</a>(
64 <span class="pre">String name, Mixed value, Object expires, String path, String domain, Boolean secure</span>)
65  : void</div><div class="description"><div class="short">Create a cookie with the specified name and value. Additional settings
66 for the cookie may be optionally specified (fo...</div><div class="long"><p>Create a cookie with the specified name and value. Additional settings
67 for the cookie may be optionally specified (for example: expiration,
68 access restriction, SSL).</p>
69 <h3 class="pa">Parameters</h3><ul><li><span class="pre">name</span> : String<div class="sub-desc"><p>The name of the cookie to set.</p>
70 </div></li><li><span class="pre">value</span> : Mixed<div class="sub-desc"><p>The value to set for the cookie.</p>
71 </div></li><li><span class="pre">expires</span> : Object<div class="sub-desc"><p>(Optional) Specify an expiration date the
72 cookie is to persist until.  Note that the specified Date object will
73 be converted to Greenwich Mean Time (GMT).</p>
74 </div></li><li><span class="pre">path</span> : String<div class="sub-desc"><p>(Optional) Setting a path on the cookie restricts
75 access to pages that match that path. Defaults to all pages (<tt>'/'</tt>).</p>
76 </div></li><li><span class="pre">domain</span> : String<div class="sub-desc"><p>(Optional) Setting a domain restricts access to
77 pages on a given domain (typically used to allow cookie access across
78 subdomains). For example, "sencha.com" will create a cookie that can be
79 accessed from any subdomain of sencha.com, including www.sencha.com,
80 support.sencha.com, etc.</p>
81 </div></li><li><span class="pre">secure</span> : Boolean<div class="sub-desc"><p>(Optional) Specify true to indicate that the cookie
82 should only be accessible via SSL on a page using the HTTPS protocol.
83 Defaults to <tt>false</tt>. Note that this will only work if the page
84 calling this code uses the HTTPS protocol, otherwise the cookie will be
85 created with default options.</p>
86 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
87 </li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>