java ee 응용 프로그램을 개발 중이며 다른 사용자에게 동일한 쿠키를 사용하는 한 페이지가 있습니다. 그래서 jquery.cookie.js 파일을 복사하고 jquery.cookie2.js라는 이름으로 새 파일을 만들었고 호출 스크립트도 변경했습니다. 그러나 작동했지만 동일한 동작을합니다. 이전 사용자에서 내가 한 일은 무엇이든 새로운 것으로 발생합니다. 나는 그것이 작동하지 않았다 후두 개의 jquery 쿠키를 설정하는 방법은 무엇입니까?
jQuery.cookie2
에
jQuery.cookie
에서 변경 있도록 쿠키 이름이 될 줄 알았는데. 여기
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};
내 질문은 하나의 응용 프로그램에 대해 서로 다른 쿠키를 사용하는 방법은 쿠키에 대한 코드는?