jQuery - cookie plugin expiry time in minute

0 votes
217 views
added Nov 19, 2018 in jQuery by LC Marshal Captain (25,770 points)
$(function() { 
    var expDate = new Date();
    var minutes = 3;
    expDate.setTime(expDate.getTime() + (minutes * 60 * 1000));
    $go = $.cookie('sto-cookie');
    if ($go == null) {
        $.cookie('sto-cookie', 'test', { path: '/', expires: expDate });
        window.location = "/example"
    }
    else {
        // do nothing
    }
});

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...