我想用永久cookie创建永久cookie,但是当我在localhost(Php wamp服务器)上运行cookie程序时,它不会创建任何cookie并显示以下错误
Not Found
The requested URL /php/evercookie_etag.php was not found on this server.
Not Found
The requested URL /php/evercookie_cache.php was not found on this server.
我已从此链接http://github.com/samyk/evercookie
下载我想创建一个永久性的cookie,以便我可以识别下面运行我的网页的系统是我的代码,请帮助解决我的问题,提前谢谢....
<html>
<head>
<script type="text/javascript" src="js/swfobject-2.2.min.js"></script>
<script type="text/javascript" src="js/evercookie.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script>
//var ec = new evercookie();
var ec = new evercookie({
baseurl: '/test', http://localhost/test
asseturi: '/assets', http://localhost/test/assets
phpuri: '/php' http://localhost/test/php
});
ec.set("id", "12345");
ec.get("id", function(value) { alert("Cookie value is " + value) });
function getCookie(best_candidate, all_candidates)
{
alert("The retrieved cookie is: " + best_candidate + "\n" +
"You can see what each storage mechanism returned " +
"by looping through the all_candidates object.");
for (var item in all_candidates)
document.write("Storage mechanism " + item +
" returned " + all_candidates[item] + " votes<br>");
}
ec.get("id", getCookie);
</script>
</head>
</html>
答案 0 :(得分:1)
您确定您的baseurl var是&#39; / test&#39; ?例如,使用github源代码,它将是:
var ec = new evercookie({
baseurl: '/evercookie-master',
asseturi: '/assets',
phpuri: '/php'
});