Why jQuery.cookie returns “[object Object]” for a single string value

后端 未结 5 1517
故里飘歌
故里飘歌 2021-01-26 11:40

I set a cookie on Rails like this,

cookies[:account] = { :value => @account.to_s, :expires => 3.month.from_now }

Which seems to be workin

5条回答
  •  無奈伤痛
    2021-01-26 12:14

    Cookie has a maximum size of 4kb only. That could be one of the reasons.

    As for my case. It certainly exceeds 4kb looking at the data alone.

    My alternative though is using localStorage.

提交回复
热议问题