1

When I logged in my page, server send me some data including array like 'user_info', 'user_token' and 'user_auth'.

And I store them into $cookieStore.

But I got one problem that length of 'user_auth' is too large to store into $cookieStore.

Logs have shown to me messages like below.

Cookie 'user_auth' possibly not set or overflowed because it was too large (5251 > 4096 bytes)!

I used $cacheFactory also, but I think this is not proper to my purpose.

How can I handle this 'user_auth' array for using every controllers without effected by page refreshing?

Thanks in advance. :)

CRDeity
  • 107
  • 1
  • 9
  • 2
    If you're not consider IE < 8, `window.localStorage` will be a good choice. For size limitation please check: https://stackoverflow.com/questions/2989284/what-is-the-max-size-of-localstorage-values – kite.js.org Oct 31 '17 at 02:02
  • @kite.js.org thanks to your comment. :) But isn't there any problem using `window.localStorage` in angularjs? I've heard many seniors recommended that do not use jquery with angular. So this makes me hesitation. – CRDeity Oct 31 '17 at 02:06
  • 2
    feel free to use `localStorage`, it's a native Javascript Object, not a jQuery feature. – kite.js.org Oct 31 '17 at 02:13
  • @kite.js.org OK. I've applied `localStorage` following your suggestion, and now I can see this working well. Thanks for your help! – CRDeity Oct 31 '17 at 02:15

0 Answers0