javascript - cookie not expires after set -


i want check cookie exist or nor , create cookie 'login_time' expire tire 2 minutes.now cookie created not expired .now cookie alive after 5 mins

if((document.cookie.indexof('login_time=')<0)){                 var expiry = new date();                 expiry.settime(expiry.gettime() + 120);                   document.cookie = 'login_time=yes; expires=' + expiry;      }  

this expire cookie.

if((document.cookie.indexof('login_time=')<0)){ var date = new date();  var minutes = 2;  date.settime(date.gettime() + (minutes * 60 * 1000));  document.cookie = 'login_time=yes; expires=' + date ;  } //3.5* 60 * 1000 = 1 minute , 30 seconds 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -