PDA

View Full Version : Disable the back button on ie


tufanocak
01-02-2003, 03:33 PM
How can we disable the back button on a
internet Explorer with javascript.

Also when we right click the button on the mouse the
history back button comes, it must be disabled.

Thanks

piz
01-02-2003, 04:21 PM
AFAIK you can't disable the back button.

You can disable the right-click menu and you can open the website in a window without toolbar.

But even than you can go back and forward with Alt + -> and Alt + <- or open the window with toolbar with Ctrl + N.

The only thing you can do is replace the history-entry wilth Javascript. So that the user won't be able to go back one step, only two steps.

Saludo
piz

glenngv
01-03-2003, 09:49 AM
Tell us what you actually want to accomplish, maybe we can find a real solution to your problem.

tufanocak
01-03-2003, 12:05 PM
i have 2 frameset on my default.asp page.it calls a another framset when user is login to the page with another backround music.
---------------------

<%
if Session("usr") = "xxxx" and Session("bgmusic") <> "xx" then
response.Write("<script language='JavaScript1.2'>parent.frames['bgmusic'].location.href='bgmusic_login.asp'</script>")
else
response.Write("")
end if
%>

-------------

So when a user login and hit the back button the page is going to the old framset with the old music on it.The page does not change, because the default.asp is:
----------------
<frameset rows="*,0" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="index.asp?lang=en" name="mainFrame" scrolling="YES">
<frame src="bgmusic.asp" name="bgmusic" scrolling="NO" noresize>
</frameset>
-----------------------
i have controlled this
with a javascript function as bellow:
it works

<script language="JavaScript"><!--
javascript:window.history.forward(1);
//--></script> on the bgmusic.asp