【发布时间】:2021-01-06 00:59:21
【问题描述】:
所以基本上,我在网站上有一个代码,一旦用户到达网站,就会播放嵌入式 soundcloud 播放列表。但是,我想做一些事情,每次用户访问网站时都会播放不同的播放列表。所以基本上:
If user visits the website for the first time
then play playlist 1
If user visits the website for the second time
then play playlist 2
If user visits the website for the third time
then play playlist 3
Elseif user visiting the website for the fourth time
then play playlist 1 again
然后重复。
(我可以播放 3-4 个不同的播放列表)
我对 JS 编程有点陌生,所以我想知道是否有一种方法可以使用 cookie 或本地存储来确定用户第 n 次访问网站并相应地播放播放列表。
如果我可以提供更多信息或澄清,请告诉我。再说一次,我对编程比较陌生,所以对于任何含糊之处,我深表歉意。
【问题讨论】:
标签: javascript html cookies local-storage