-2

I want to cookie a user so that they only see the promotion prize once. If they have accessed the page already a pop-up message will appear.

I am not sure where to start here - is this even possible using JS if so how any recommendations or code snippets are welcome.

Avinash
  • 2,093
  • 4
  • 28
  • 41
user3767554
  • 147
  • 1
  • 12
  • What problems are you facing? Simply create a cookie or localstorage and delete them once they have been shown. – Nitesh Feb 22 '17 at 09:12
  • google for window.localStorage, window.sessionStorage. In general, google is a good place to start. – Vladimir M Feb 22 '17 at 09:12

1 Answers1

0

You want to do this server side because as Rob pointed out, it is VERY EASY to circumvent any client side logic like this. Ideally if you users log in, you would store in your persistence layer (database? even a file?) their user name and if it is already there you know it has been viewed already by that user. No client side solution is secure for this purpose unfortunately.

Milney
  • 6,253
  • 2
  • 19
  • 33