Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Serverlet/JSP

 
Raghavendra Holla
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
IS there any way of disabling browsers back button using JSP or Servlet code?. Any tricks in HTML?
regards
Holla
 
Poornima Shetty
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic