-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
114 lines (108 loc) · 3.81 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Super Cookies - Basic Example</title>
<script src="js/swfobject/swfobject.js" type="text/javascript"></script>
<script>
//var superCookieSetup = {crossDomain:true, swfURL:"../swf/supercookie.swf", expressInstaller:"../js/swfobject/expressInstall.swf"};
</script>
<script src="js/superCookie-min.js" type="text/javascript"></script>
<style type="text/css">
body{font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif; font-size:14px; background:#fff}
.small {
color: #fff;
font-family: Arial,Helvetica,sans-serif;
font-size: 10px;
font-weight: normal;
line-height: 12px;
position: relative;
top: -10px;
}
h1, h2, h3{margin:0; padding:0}
.topmenu{}
.topmenu td{background:#333; color:#FFFFFF; text-align:center}
.topmenu td a, .topmenu td a:visited{color:#fff;}
.topmenu td.active{background:#090; color:#333}
.topmenu td.active a, .topmenu td.active a:visited{color:#fff; text-decoration:none}
.tblWhite{background:#FFFFFF}
pre{overflow-x:auto; overflow-y:hidden; background:#707070; color:#fff; margin:0; padding:20px; max-width:750px}
.hide, .hidden{display:none}
code.blue{color:#66CCCC}
</style>
</head>
<body onload="getCookie()">
<table width="100%" border="0" cellspacing="1" cellpadding="5" class="topmenu help">
<tr>
<td colspan="4" align="center" class="title"><h1>Javascript Super Cookie<span id="ver"></span> <a title="Download" href="http://www.marghoobsuleman.com/cross-domain-cookies" class="small">Download</a></h1></td>
</tr>
<tr>
<td class="active"><a href="examples/index.html">Basic</a></td>
<td><a href="examples/multiple-items.html">Save Objects/Data Types</a></td>
<td><a href="examples/cross-domain.html">Cross Domain</a></td>
<td align="left"><a href="examples/help.html">Documentation</a></td>
</tr>
</table>
<p> </p>
<script type="text/javascript">
function setCookie() {
var val = document.getElementById("name").value;
//if document is loaded
superCookie.setItem("name", val); // this is not the best way.
/*
//if document is not loaded
//we should use like this
if(superCookie.isReady) {
setItem("name", val);
} else {
superCookie.onReady(function() {
setItem("name", val);
})
}
function setItem(key, value) {
superCookie.setItem(key, value); // this is not a best way.
}
*/
document.getElementById("status").innerHTML = "<span style='color:green'>Cookie has been set. Refresh to see.</span>"
}
function getCookie() {
var val = superCookie.getItem("name");
document.getElementById("name").value = val || "";
}
if(superCookie.isReady) {
superCookie.setItem("name", "lucky");
} else {
superCookie.onReady(function() {
superCookie.setItem("name", "lucky");
})
}
</script>
<fieldset>
<legend><strong>Single Value</strong></legend>
<input type="text" name="name" id="name" value="" /> <input type="button" onclick="setCookie()" value="Set Super Cookie" />
</fieldset>
<div id="status" style="padding:10px 0;"> Click on button to set the cookie. </div>
<!-- supercookie div -->
<div id="msCookieDiv"></div>
<!-- supercookie div -->
<script>
function testCookie() {
for(var i=0;i<100000;i++) {
superCookie.setItem("Item"+i, "The quick brown fox jumps over the little lazy dog.");
}
}
</script>
<pre>
<code>
//in header
<script src="js/swfobject/swfobject.js" type="text/javascript"></script>
<script>
//var superCookieSetup = {swfURL:"swf/supercookie.swf", expressInstaller:"js/swfobject/expressInstall.swf"};
</script>
<script src="js/superCookie-min.js" type="text/javascript"></script>
//and this div any where in body tag
<div id="msCookieDiv"></div>
</code>
</pre>
</body>
</html>