stop refresh?

  • jannin
  • Beginner
  • Beginner
  • User avatar
  • Posts: 40
  • Loc: Cranbrook, BC Canada

Post 3+ Months Ago

Hey all,
Just wondering if there's any way to stop someone from refreshing a page?
Php would be preferable but I can probably manage something else...
The reason I'm asking is because I have a form sending information to a database. I don't want the user to be able to refresh the page and accidentally/on purpose send the information twice. I figured I could just put a time limit on it; they can only go back to the page every day, or something, which will work fine for my cause, but now I'm just curious as to whether it's possible.
Thanks all!
/jannin
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

Well, I don't know if that is really possible, most of the sites that I've seen with something like you want just put a nice message that says please do not refresh this page until you are redirected.
  • Managedlinks
  • Proficient
  • Proficient
  • Managedlinks
  • Posts: 294

Post 3+ Months Ago

You cant stop people refreshing a page. but you can stop them from clicking a button twice using javascript. you can also add a hidden field to a page that contains a unique identifier

When your processing script receives the page the first thing it does is check the identifier to see if it has been used before. if it has the refresh is ignored and a message returned. or anything else you may want.
  • jannin
  • Beginner
  • Beginner
  • User avatar
  • Posts: 40
  • Loc: Cranbrook, BC Canada

Post 3+ Months Ago

Now why didn't I think of that?
Thanks a bunch, Managedlinks, works like a charm!
  • Managedlinks
  • Proficient
  • Proficient
  • Managedlinks
  • Posts: 294

Post 3+ Months Ago

:)

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 45 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.