iqiyi设置cookie
var string = "此处替换iqiyi的cookie";
var getCookie = function( str) {
var cookieArr = str.split(";");
if(cookieArr == "") return ;
var result = {};
for(var i=0; i<cookieArr.length; i++) {
cookieArr[i] = cookieArr[i].trim();
var key = cookieArr[i].split("=")[0].trim();
var value = cookieArr[i].substr(key.length+1).trim();
result[key] = value;
};
return result;
}
var setCookie = function(key, value, day) {
var date = new Date();
date.setDate(date.getDate() + day);
document.cookie = key+"="+value+"; expires="+date.toGMTString()+"; path=/" + "; domain=.iqiyi.com";
}
var oldCookies = getCookie(string);
//removeOld-cookie;
for(var p in oldCookies) {
setCookie(p, oldCookies[p], -40);
} var cookies = getCookie(string);
for(var p in cookies) {
setCookie(p, cookies[p], 40);
}
youku cookie设置:
var string = "此处替换youku网cookie";
var getCookie = function( str) {
var cookieArr = str.split(";");
if(cookieArr == "") return ;
var result = {};
for(var i=0; i<cookieArr.length; i++) {
cookieArr[i] = cookieArr[i].trim();
var key = cookieArr[i].split("=")[0].trim();
var value = cookieArr[i].substr(key.length+1).trim();
result[key] = value;
};
return result;
}
var setCookie = function(key, value, day) {
var date = new Date();
date.setDate(date.getDate() + day);
document.cookie = key+"="+value+"; expires="+date.toGMTString()+"; path=/" + "; domain=.youku.com";
}
var oldCookies = getCookie(string);
//removeOld-cookie;
for(var p in oldCookies) {
setCookie(p, oldCookies[p], -40);
} var cookies = getCookie(string);
for(var p in cookies) {
setCookie(p, cookies[p], 40);
}