How to make a link clickable once per person

This forum is for all Flare issues not related to any of the other categories.
Post Reply
jgorea
Jr. Propeller Head
Posts: 1
Joined: Thu Oct 24, 2024 6:47 am

How to make a link clickable once per person

Post by jgorea »

Hi,

I'm pretty sure this is impossible without having some user authentication, but has anyone figured out a way to allow people click a link one time, but then hide or disable the link so they cannot click again?

I think javascript can be leveraged to do this based on user cache, but refreshing or reloading the page will clear it and make the link clickable again. Wondering if there are any other ways or tricks to achieve this.

Thanks!
NorthEast
Master Propellus Maximus
Posts: 6404
Joined: Mon Mar 05, 2007 8:33 am

Re: How to make a link clickable once per person

Post by NorthEast »

If it has to be 100% robust, then yes you do need user authentication - as you'd need to record (at your end) if a user has clicked the link.

If it's for something that doesn't matter very much, then you could use the browser storage (localstorage or sessionstorage) or cookies to record if a user clicked the link. So that could work for a user on one device until they cleared their browser cache (or used a private browsing mode).

So you could use localStorage to (a) save a bit of data when the user clicks a link, and (b) check if the data exists in localstorage and show/hide the link as appropriate.
https://www.w3schools.com/jsref/prop_wi ... torage.asp
Post Reply