Jump to content

Recommended Posts

Ideally, you do not want to disable refresh using javascript because people can always disable javascript in their browser and some browser just simply don't have javascript support, and your application could wind up being exploited, especially if you are using post data or sending information to a database.

 

A better solution would be to redirect to another page that would make no difference if it were refreshed

You can't stop the user from refreshing the page with php.  It has to be done with javascript.  What you can do is start a session and use a session var to track whether the user has gone to the page or not.  User goes to page, session starts, var is set to 1 or true or whatever.  User refreshes, new request sent to server, server checks for var.  var exists, so display something different.

I think when the op refers to "banks can do it" he means, when you're going through a "step" situation , like a transaction. What happens is that the server side (session) maintains a record of the last state you were in (i.e. step 3) , and on going "back" in the browser, or "refreshing" the server asks what step the last one was (from session info), and decides upon logic depending on that.

 

You can't disable a persons browser capabalities. And even if you could I wouldn't recommend it as you're interfering with a common user interface (making your site less usable).

 

Describe to us what your problem is and why you want to faciliate this. Is your problem regarding "double posting" of information? i.e. they fill in a form, post to another page, and then refresh that page (asking for re-post) ?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.