mal*_*ers 4 javascript session-variables session-cookies
I am using sessionStorage to ensure an action only happens once per session. However, if a user opens a new window - the sessionStorage is not carried over to the new window, and the action is executed again. See my code below:
if sessionStorage.alreadyTracked != "1"
sessionStorage.alreadyTracked = "1"
...
Run Code Online (Sandbox Code Playgroud)
Is there an easy way to do this that applies to all tabs? Maybe I need to use a cookie?
| 归档时间: |
|
| 查看次数: |
14321 次 |
| 最近记录: |