Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6345077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:45:14+00:00 2026-05-24T20:45:14+00:00

Ive got a webpage where users input a story/event and other users can like

  • 0

Ive got a webpage where users input a story/event and other users can like or dislike the post.

I want to create a cookie that allows users to only vote once per post (each page will have many posts)

I know that storing in a database would be a better way incase the user delete his/her cookies but the post will not be of high importance. Also i would imagine that creating a database for cookies would take a lot of code and the database would be huge as there will be mass amount of posts and likes for each.

I think creating a cookie would be a better option for what i need

I have no idea how to do this though and ive searched high and low on google but i dont know if im searching wrong key words or its just my lack of knowledge letting me down

So could someone please advise me how to create this cookie for what i need please

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:45:15+00:00Added an answer on May 24, 2026 at 8:45 pm

    The modern replacement for cookies is localStorage. That’s basically a variable of which the data will be saved on the client’s computer, so you can access it at any time, even when the user has navigated or rebooted his computer.

    It’s rather straight-forward, e.g. you could do:

    function vote() {
        if(localStorage['votedForPost' + postid] == 'true') return; // abort if already voted
        // ...
        localStorage['votedForPost' + postid] = 'true'; // you can only store strings
    }
    

    The only drawback is that it’s not available in all browsers, especially older ones which are still used such as IE7.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ive got a text input whereby somebody can begin to type and then below
Ive got a button in a UICell. I want a list(a table view like
I've got a program I would like to use to input a password and
I've got an editor in javascript on my webpage and I would like to
I've got the following piece of code in an aspx webpage: Response.Redirect(/Someurl/); I also
I've got a group of inter-related classes that are all overridden together to create
I've got many, many mp3 files that I would like to merge into a
So ive just started learning python on WAMP, ive got the results of a
here is the case: ive got 2 lists on my website. country and region.
Well, I got a MySQL db, encoded as utf8_unicode_ci, and it runs like a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.