我有这个脚本;
会话cookie没有显示其中的路径“2年过期”cookie确实有路径。如何获取会话cookie中的路径?
<script>
function func1() {
document.write("<div class='demo' ><p id='mpuid'></p></div><style>.demo
{display:none; position: absolute; left: 0px; top: 0px; z-index: -1000 }
</style>");
}
function func2 () {
document.getElementById("mpuid").innerHTML = new Date().getTime() + '.'
+ Math.random().toString(36).substring(5);
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(func1);
addLoadEvent(func2);
addLoadEvent(function() {
if(Cookies.set('mpuid') == null || Cookies.set('mpuid') == "") {
Cookies.set('mpuid', value =
document.getElementById('mpuid').textContent);
var myDate = new Date();
myDate.setMonth(myDate.getMonth() + 24);
document.cookie = 'mpuid' +"=" + value + ";expires=" + myDate
+ "path=/";
}
})
</script>
[cookies being set][1]