Deposit token in a cookie

 

First, the introduction of jquery.js, and the introduction of jquery.cookie.js

<script type="text/javascript" src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script>

 

Next, you can use $ .cookie ( 'token', 'xxxxxxxxxxxx') to store the token. token such settings, will be deleted after the default browser to turn off

If you want to set the survival time, you can add expires, the unit is the day

$.cookie('the_cookie', 'the_value', { expires: 10 });

The default is only a page to get access

If you want to get all pages can be accessed, then you put the path to the root path

$.cookie('the_cookie', 'the_value', { expires: 10, path: '/' });

When you delete a token, you can set the value token is null

Guess you like

Origin blog.csdn.net/abc_123456___/article/details/89409347