Home Page
RABiD BUNNY FEVER
K.T.K

  • January 28, 2020, 02:38:29 AM *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Official site launch very soon, hurrah!


Author Topic: JavaScript Cookies Functions  (Read 3504 times)

Dakusan

  • Programmer Person
  • Administrator
  • Hero Member
  • *****
  • Posts: 527
    • View Profile
    • Dakusan's Domain
JavaScript Cookies Functions
« on: August 06, 2013, 12:00:33 PM »

Original post for JavaScript Cookies Functions can be found at https://www.castledragmire.com/Posts/JavaScript_Cookies_Functions.
Originally posted on: 08/06/13

Just throwing these up here for reference. Simple JavaScript scripts to get and set cookies.  Not particularly foolproof, robust, or fully featured.


function SetCookie(Name, Value, SecondsToExpire) { document.cookie=Name+"="+escape(Value)+"; expires="+new Date(new Date().getTime()+SecondsToExpire*1000).toUTCString(); }
function GetCookie(Name)
{
   var Match=document.cookie.match(new RegExp('(?:^|; ?)'+Name+'=(.*?)(?:;|$)'));
   return Match ? unescape(Match[1]) : null;
}
Logged