-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestCookie.html
More file actions
44 lines (41 loc) · 747 Bytes
/
testCookie.html
File metadata and controls
44 lines (41 loc) · 747 Bytes
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
<html>
<head>
<script type="text/javascript">
function getCookie()
{
if (document.cookie.length>0)
{
return document.cookie.replace("downloadFlag=", '')
}
}
function setCookie()
{
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie="downloadFlag=true"+";expires="+exp.toGMTString();
}
function checkCookie()
{
downloadFlag=getCookie()
if (downloadFlag=="true")
{
window.location.href = "testCookie://downloadFlag"
}
else
{
setCookie()
}
}
</script>
<title>
SafariDataToAppDemo
</title>
<meta charset="utf-8">
</head>
<body onLoad="checkCookie()">
<div>
SafariDataToAppDemo
</div>
</body>
</html>