wood burning stoves*
The moose likes Servlets and the fly likes Serverlet/JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Serverlet/JSP" Watch "Serverlet/JSP" New topic
Author

Serverlet/JSP

Raghavendra Holla
Ranch Hand

Joined: Jun 02, 2000
Posts: 58
Hello ,
IS there any way of disabling browsers back button using JSP or Servlet code?. Any tricks in HTML?
regards
Holla
Poornima Shetty
Greenhorn

Joined: Dec 12, 2000
Posts: 26
calling a javascript function using Loaction.replace() method disables the back button althought it doesnt appear to us as though its disabled but using the below function you can check it up:
<html>
<head>
<SCRIPT>
function displayCatalog()
{
var seaName="" ;
var catName="" ;
for (var i=0; i < document.catalogForm.season.length; i++)
{
if (document.catalogForm.season[i].checked)
{
seaName=document.catalogForm.season[i].value ;
i=document.catalogForm.season.length;
}
}
for (var i in document.catalogForm.category)
{
if (document.catalogForm.category[i].checked)
{
catName=document.catalogForm.category[i].value;
i=document.catalogForm.category.length ;
}
}
fileName=seaName + catName + ".html" ;
location.replace(fileName)
}
</SCRIPT>
<FORM NAME="catalogForm">
<B>Which catalog do you want to see?</B>
<P><B>Season</B><BR>
<INPUT TYPE="radio" NAME="season" VALUE="q1" CHECKED>Spring/Summer<BR>
<INPUT TYPE="radio" NAME="season" VALUE="q3">Fall/Winter
<P><B>Category</B><BR><INPUT TYPE="radio" NAME="category" VALUE="clo" CHECKED>Clothing<BR>
<INPUT TYPE="radio" NAME="category" VALUE="lin">Linens<BR><INPUT TYPE="radio" NAME="category" VALUE="hom">Home & Garden
<P><INPUT TYPE="button" VALUE="Go" onClick="displayCatalog()">
</FORM>
</html>
Poornima Shetty
Greenhorn

Joined: Dec 12, 2000
Posts: 26
Raghu,in the above code when you check it up ,though in the beginning you start from the catalog page... when you click on go and navigate to the next page
,you can observe that now onclick of back button you cant come back to the catalog screen again.
Raghavendra Holla
Ranch Hand

Joined: Jun 02, 2000
Posts: 58
Thanks poornima. But if java script disabled, this won't work. I don't know there is any HTML tag or meta tag which does this.
regards,
Holla.
tcspillai
Greenhorn

Joined: Jun 04, 2001
Posts: 2
Originally posted by Poornima Shetty:
Raghu,in the above code when you check it up ,though in the beginning you start from the catalog page... when you click on go and navigate to the next page
,you can observe that now onclick of back button you cant come back to the catalog screen again.

hi,
i tried to use the HTML code but it doesnt disable the back button..
suggestions pls..

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Serverlet/JSP
 
Similar Threads
query string
OutputStream already obtained
Simple "email a page" functionality?
No output in jsp
Standard actions in a JSP document?