[英]Keep track of likes without a user login
The blog of my website allows liking the posts.我网站的博客允许喜欢这些帖子。 But this is only for users who signup.
但这仅适用于注册用户。 So if some new user likes a blog post , I won't be able to record his like .
所以如果有新用户点赞了一篇博文,我就无法记录他的点赞了。
My questions is how can I keep track whether a visitor has liked a blog or not without signing up ?我的问题是如何在不注册的情况下跟踪访问者是否喜欢博客?
I guess you could record their 'like' in a cookie so they can't (note 1) 'like' the same post more than once.我想你可以在 cookie 中记录他们的“喜欢”,这样他们就不能(注 1)多次“喜欢”同一个帖子。 You'd need to check for the cookie value of course.
当然,您需要检查 cookie 值。
Note 1: There's no guarantee that the user (or robot) has cookies enabled though, so it's impossible to stop multiple 'likes'.注意 1:虽然无法保证用户(或机器人)启用了 cookie,因此无法阻止多个“喜欢”。 It depends how important this is to you.
这取决于这对您有多重要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.