|
<?php |
|
|
|
/** |
|
* This file will produce a duplicate cookie for "test_cookie" ONLY on the |
|
* iOS version of Google Chrome. This confuses web servers on the following |
|
* request and can result in unintended behavior. |
|
*/ |
|
|
|
$name = 'test_cookie'; |
|
$path = '/'; |
|
$domain = '.' . $_SERVER['HTTP_HOST']; |
|
|
|
// delete the cookie while specifying the domain |
|
setcookie($name, '', time()-3600, $path, $domain); |
|
|
|
// delete the cookie WITHOUT the domain |
|
// this results in a duplicate cookie on Chrome / iOS |
|
setcookie($name, '', time()-3600, $path); |
|
|
|
// set the new value of the cookie |
|
setcookie($name, 'test_value', time() + (7 * 24 * 60 * 60), $path, $domain); |
|
?> |
|
|
|
|
|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<meta charset="utf-8"> |
|
<title>Cookie Test</title> |
|
<script src="//code.jquery.com/jquery-2.1.4.min.js" charset="utf-8"></script> |
|
|
|
<script type="text/javascript"> |
|
/** |
|
* On the client, read in the cookies and render them in the log |
|
*/ |
|
$(function() { |
|
var cookies = document.cookie.split('; '); |
|
for (var i=0; i<cookies.length; i++) { |
|
var cookie = cookies[i].split('='); |
|
$('#log').append('<li><span class="cookie-name">' + cookie[0] + '</span><span class="cookie-value">' + cookie[1] + '</span></li>') |
|
} |
|
}); |
|
</script> |
|
|
|
<style> |
|
/** |
|
* Basic styles for the log |
|
*/ |
|
|
|
body { |
|
max-width: 1000px; |
|
margin: 2em auto; |
|
} |
|
|
|
#log { |
|
background-color: #eee; |
|
border: 2px solid #ccc; |
|
border-radius: 10px; |
|
font: 16px monospace; |
|
list-style: none; |
|
margin: 0; |
|
padding: 16px; |
|
} |
|
|
|
#log .cookie-name { |
|
color: green; |
|
font-weight: bold; |
|
} |
|
|
|
#log .cookie-name:after { |
|
content: ' = '; |
|
color: #999; |
|
} |
|
|
|
#log .cookie-value:before, |
|
#log .cookie-value:after { |
|
content: '"'; |
|
color: #999; |
|
font-weight: bold; |
|
} |
|
</style> |
|
|
|
</head> |
|
<body> |
|
<!-- The log / console for displaying cookie values --> |
|
<h1>Cookie Console</h1> |
|
<ul id="log"></ul> |
|
</body> |
|
</html> |