Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling the Back button

Status
Not open for further replies.

shaunk

Programmer
Aug 20, 2001
402
AU
I have an application running on a frames page and I want to control the navigation logic myself i.e I want to disable the pages Back and Fowards button.
Is there an onload command I can use.
 
There is no way to eliminate user browing, whether it be moving forward, backward, browsing away from your site, or closing the window.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Interfering with user functionality should be death penalty!

As is using frames... alright, misusing frames. Few people use them correctly. A NOFRAMES tag shouldn't be optional, and the page should be navigatable without frames (w/o losing (much of) the content).

Text only browsers are in a lot of handheld devices and as bluetooth and WIFI technologies become more common place there will be a lot more simple tools that have web browsers in them (Toasters that you can check your e-mail from, fridges that maintain a webserver so you can check your fridge before leaving work to see if you need to stop at the store). make sure that you can veiw your site in lynx and/or links before calling it "done."

Besides, there is also a large body ofpeople who just hate frames, why lose visitors?

That being said, there probably is a way to clear back button's history -- but I wouldn't know what it is or reccomend it.
 
OK..to avoid the death penalty I will re-assess my villainous intent to disable the back button. Frames..sorry , I'm to far down the path to ruin on this particular site. Layers next time?
The reason I need this is because I am coding a footy tipping website where a logical body of work finishes with a thankyou page etc. From this page, I want the user to be forced to return to the main page so the next user can logon. If I allow them to page back, another user could just re-enter the previous person's tips. So clearing the back buttons history would be perfect.
I guess in essence, I need to user to enter and exit a secure transaction.

 
What do you use as back-end?
PHP or ASP?

If you use PHP, you can simply store it in sessions and on the tip_start.php, you kill the session, if it already is set.
on tip_send.php, you can send the tip..

eg. if they "step back", it will kill all session data and then reset the form.

I guess you can do the same in ASP. I havent coded in ASP for ages.

Olav Alexander Mjelde
Admin & Webmaster
 
Couldn't you just have the window close itself?

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Thanks for your time on this all of you.
I am using ASP as the backend and have found a host of information on the net...which is where I should have started.
It appears that of all questions asked re APS, this question ranks as the highest frequency.
Will post the code when I get it working.
Thanks again
 
cflava: the "danger" with client side, is that it is not always supported, and users can turn it off, if they want to abuse something

Olav Alexander Mjelde
Admin & Webmaster
 
which is exactly why it's not dangerous. if a user does not want something to happen, it shouldn't happen.

otherwise, that user goes buh-bye.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
cflava: I think your destroying your own argument here, as you first say it's ok to have javascript do some hokus-pokus, then later, you say it's ok that the user does not have javascript, as long as the user does not know that he is missing out on something.

eg. there must be a plan-b, if you run on plan-a.

No hokus pokus for me, I'll rather let my users click some "dumb" link or button, or even close the window on theire own.


If they are 1337 enough to visit my pages, they should be able to close a window.

Olav Alexander Mjelde
Admin & Webmaster
 
i bow down to you. i am not destroying anything. i simply raised a question "why don't you have js do it?" it was a question.

i don't even know how the conversation got to this point. i agree 110% with clearing all session variables and returning to the login page. that's what i do all the time with php.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
I ended up controlling the paging back thru session variables and the insertion of a dummy holding page between the data entry/confirm page and the committ page.
The dummy page just held the data from the entry page in a form and submitted onload. The onload command executes after the form is populated from the previous page.
If the user tries to page back from the committ/thankyou page, the dummy page just submits again with an action of the committ page. Then , on the committ page, I have the session variable logic setup i.e if we've been here before, then redirect to logon page...where I kill the session first up.
Works perfectly...once again, probably sending shudders through those who actualy know how to code this stuff, but from my reading on the net, no meta tag or ASP Request.Object solution is fool proof. Great discussion on it here...Thanks all.
 
What about clearing all sesson variables/cookies when the thank you page loads? Then, if you check for being logged in on other pages, any submission without a current login could automatically redirect to the login page. The thank you page would be the page that writes the data to the server, and if the session variable is missing, then would redirect without resubmitting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top