简体   繁体   English

在Meteor JavaScript中创建一个恒定会话

[英]Create a constant session in Meteor javascript

I am building web store using Meteor and having issues with adding items to my cart. 我正在使用Meteor建立网络商店,并且在向购物车中添加商品时遇到问题。 Right now, each cart is uniquely identified by a Session ID. 现在,每个购物车都由会话ID唯一标识。 However, if I have two browser tabs open, each tab will have its own Session ID. 但是,如果我打开了两个浏览器选项卡,则每个选项卡将具有其自己的会话ID。 Therefore, is there a method or technique I can use to create a Session ID that is constant across all browser tabs? 因此,是否可以使用一种方法或技术来创建在所有浏览器选项卡中都恒定的会话ID?

Thank you! 谢谢!

You have two option here: 您有两种选择:

  1. Save on temporary collection on server where it will persist across browsers / devices. 保存在服务器上的临时集合中,该集合将在浏览器/设备之间持久保存。

  2. Use localStrorage where it will persist acroos tab on the same browser. 使用localStrorage,它将在同一浏览器上保留acroos选项卡。 Take a look AmplifyJS Store and meteor-persistent-session . 看一看AmplifyJS Storemeteor-persistent-session

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM