Skip to content

Instantly share code, notes, and snippets.

View VladyslavHimself's full-sized avatar
🔷

vladyslavhimself VladyslavHimself

🔷
View GitHub Profile
@KrotovRoman
KrotovRoman / new_gist_file.js
Created November 6, 2013 04:52
Как записать данные в cookies Работа с куками. Работа с печеньками.
// установить куки
function setCookie( name, value, expires, path, domain, secure ) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString(): "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
// использование
setCookie( 'option', id_option, new Date( (new Date()).getTime() + ( 60 * 60 * 24*24 ) ), '/' );