hi,
i want to disable the back button in IE browser.
i have the code but it's not working

logout.jsp

<script language="javascript">
    window.history.forward();
</script>

i don't know where to put the script code
it is put in the logout.jsp file or before
please help me out of this

Member Avatar for rakhi4110

Hi sasi..
U can use it in the body tag as shown below..

<html>
<head>
<script type="text/javaScript">
function disableBackButton()
{
window.history.forward();
}
setTimeout("disableBackButton()", 0);
</script>
</head>
<body onload="disableBackButton()">
<input type="button" name="b1" value="b1"/>
<a href="z.html">Clcik me</a>
</body>
</html>

If you are using Firefox browser then you use <body onunload> function instead of onload function. check whether it is working or not and inform me.

Thanks and regards,
RAKHI

hi rakhi,

thanks its working
is there any possible with out going to the next page

my requirement is i am working lot of pages if i click logout page means i display the home page from that home page i don't want to go back

in my logout page i redirect the index page then where do i put that code
window.history.forward()

Member Avatar for rakhi4110

Well sasi,
I'm not very sure about that. I am not sure in which language you are working on and eveerything too. Anyway i can post some links which might be useful to you.
Check them out and see if anything works your way.

If you are using JSP or something related to java check this out
Solving the logout problem properly and elegantly

Even if not you can refer to that to get an idea.

also here is another link
Back Button Disable on browser window after logged out

Inform me if your problem is getting solved

Thanks and regards,
RAKHI

hi rakhi
i am working with jsp
here is my code it's not working please help me
1.jsp

<html>
<head>
</head>
<body>
<a href="z.html">Clcik me</a>
</body>
</html>

z.html

<html>
<head>
<script language=“javascript”>
window.location="1.jsp";
window.history.forward(0);
</script>
</head>
<body>
<table width=98% align=center>
<td align=center>
<IMG border=0 id=IMG2 src="1.jpg" align=center valign=top>
</td></table>
<table width=98% align=center class=tcs>
<td align=center>
You have successfully logged out of the system
</td></table>
</body>
</html>

my requirement is, if i came to the z.html i don't want to go back

Member Avatar for rakhi4110

Hi Sasi,
My pleasure to help you.. If your problem is solved then mark this thread as solved.
Regards,
RAKHI

<a href="d:\jsp.pdf">view</a> this is not working
but jsp.pdf is within the web application ( href="jsp.pdf" ) is fine.

The problem is when i run the program the url is always start with http:\localhost\
so if i give ( href="d:\jsp.pdf") like this the url is http:\localhost\d:\jsp.pdf
how to resolve this please help me

hi Rakhi,
it is not working with safari browser.
please help for all browser please
Regards
Satyaveer Saini

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.