[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1126
  • Last Modified:

how to disable the back button on the browser

Hello Experts,

I am trying to develop online test tool in ASP.NET, I have used Ajax lookup to get the questions and 4 multiple answers for it. It seems to be working fine. However, the problem is, I can use the back button on the browser navigate to the previously answered question and change or view the answer. I would like to completely disable the back button on the browser as long as they are with in the test application(pages).

Please can someone advise if there is any trick/logic to do this?

Thanks for your help.

Regards
Kay
0
learningnet
Asked:
learningnet
3 Solutions
 
Gyanendra SinghArchitectCommented:
:) no you cant ...

Refer this site for some alternative

http://www.irt.org/script/311.htm
0
 
learningnetAuthor Commented:
Thanks for your Comment.

However, none of the suggestion from that article worked for me ...
0
 
WesleySaysHiCommented:
You can set up a two-frame format that has one frame set to 100% and the second  to zero.

<FRAMESET COLS="100%,*">
<FRAME SRC="goback.html">
<FRAME SRC="fillerpage.html">
</FRAMESET>

The page "goback.html" contains only the code:

<META HTTP-EQUIV="refresh" CONTENT=".0; URL=nobackpage.html">

When the user logs in and the two frames load, the page "goback.html" redirects the 100% frame to jump to a new page, "nobackpage.html". If the user clicks "Back", the "goback.html" page loads and the "nobackpage.html" page pops right back up.

The above method is called "Frame Trap" and is the most used method to disable the back button on the browser.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
BadotzCommented:
Why in the world would you want to do this?

If you play God with a Poor User's browser, then you deserve all of the wrath they throw your way.
0
 
BadotzCommented:
You would be better served to keep track of the answered questions, and check some variable to disallow the page to be displayed. You could then redisplay the current page.

Be aware that users (me) do *not* like to be forced to go in any one direction. If I want to go back a page, you should accomodate me. What you show me is up to you, but you should not (ever?) prevent me from back-tracking.
0
 
scrathcyboyCommented:
" I would like to completely disable the back button on the browser "

ABSOLUTELY IMPOSSIBLE.

Rewrite the browser code -- if you can't do that, the answer is ABSOLUTELY IMPOSSIBLE.
0
 
BadotzCommented:
Of course it is impossible. It is the reasoning I'm after.

Just another control freak who thinks he can coerce the Poor User into following his way of thinking. Fraught with peril. Pointless, too.

But the young will have their say, eh?
0
 
WrathyimpCommented:
Dear WesleySaysHi,

i would like to know your method of two iframes:
<FRAMESET COLS="100%,*">
<FRAME SRC="goback.html">
<FRAME SRC="fillerpage.html">
</FRAMESET>
The page "goback.html" contains only the code:

<META HTTP-EQUIV="refresh" CONTENT=".0; URL=nobackpage.html">

What is the fillerpage.html?, is it the page where we put our conents?
Under goback.html page can we point the nobackage.html to our start page?
Or do we need to creat a blank "nobackpage.html" page?
by my understanding there will be 4 pages:
1. index.html (having frameset)
2. goback.html
3. nobackpage.html
4. fillerpage.html (content page for the iframe)

Yes this comments is on very old post, but if you can reply, will help me alot.

Thanks all.
0
 
BadotzCommented:
A Google search returns

Results 1 - 50 of about 37,300 English pages for frame trap disable back button. (0.36 seconds)

There should be something of interest in that haystack, eh?
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now