[thelist] Disabling Back Button with Alert

Bob Haroche spambait at onpointsolutions.com
Thu Nov 3 11:05:46 CST 2005


I need to disable the back button within a portion of an intranet web
application (to avoid losing session variables). I know the
js to do this but I'd also like to pop up an alert to let the user know
why the back button is disabled. The following doesn't work:

<script>
function goforward() {
      if(window.history.forward(1) != null)
                       alert('We disabled the back button, blah, blah');
                       history.forward();
}
</script>

<body onLoad="goforward()">

It seems that once the browser receives the history.forward() 
instruction, it ignores all else. Is there a way to do  this with js? 
The app is coded in CFML so perhaps there's a technique using that 
language as well.

(And yes, I know disabling the back button is "bad" but it's being used 
in a limited area).

Thanks.

-- 
Regards,
Bob Haroche

OnPoint Solutions
www.OnPointSolutions.com







More information about the thelist mailing list