How to make an updating like btn in javascript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make an updating like btn in javascript?

I want to make an actual like button, when the page refreshes the number of likes is still there. I know I could use local storage but it will only work on my server not anyone else's. I want to find a way to achieve this using firebase storage, but Idk how. Can anyone guide me through this?

20th Sep 2020, 7:17 PM
Coder
Coder - avatar
1 Answer
+ 5
for upvotes that only work for may people live check this code out: https://code.sololearn.com/Wvso5ukoN53J/?ref=app It uses firebase firestore(to store data), wich is free, but sadly has a limit The only way to prevent users from posting more than one up-or downvote is by making accounts, they can use multiple account abuse, or use cookies/localstorage to store if they already upvoted, but they can clear cache or use ignocito mode the other strategy is to use cookies/localstorage for storing upvotes, but data only applies for 1 user and is cleared when they clear cache or use ignocito mode Here is a tutorial to... cookies: https://www.w3schools.com/js/js_cookies.asp localstorage:https://www.w3schools.com/html/html5_webstorage.asp firestore: firebase.com
20th Sep 2020, 11:35 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar