how to get session javascript ws3schools
function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
setCookie("user_email","[email protected]",30); //set "user_email" cookie, expires in 30 days
var userEmail=getCookie("user_email");//"[email protected]"
Also in JavaScript:
- document.title you clicked count times
- how to import js via script in react
- align left text in reactstrap
- webpack Module not found: Error: Can't resolve '../
- comments in js
- javascript check if string contains a text substring
- google sign up react npm
- react native vector icons
- js string
- open bytes in new tab angular
- useref react
- print all the nested json key value pair c#
- how to add oAuth google signin in react native app
- how to use flatlist keyextractor
- pyspark from_json example
- javascript select letter in string
- jquery add style
- fetch api in js
- jquery basic authenticated get user
- usestate() react
- subject in angular 8
- orm for postgres node js
- angular maxlength directive input type number
- refresh a div jquery