BROWSER BACK BUTTON

Is it possible to Disable browser back button?
[61 byte] By [meely] at [2007-9-26 1:13:51]
# 1

You can pop up a browser window with no back button or other controls:

<html>

<head>

<script LANGUAGE="JavaScript">

<!--

/* Browsercheck: */

nn=(navigator.appName=="Netscape")?1:0;

ie=(navigator.appVersion.indexOf("MSIE")!=-1)?1:0;

function popup(page,width,height)

{

if (nn){viewpage=window.open(page,"","scrollbars=1,screenX=0,screenY=0,width="+width+",height="+height);}

if (ie){viewpage=window.open(page,"","scrollbars=1,top=0,left=0,width="+width+",height="+height);}

}

//-->

</script>

</head>

<body>

<a href="javascript:popup('http://Host:portNo/myUri,600,400);">Click here to open window</a>

</body></html>

artntek at 2007-6-29 0:11:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thx Artntek... I don't want to open a pop up a window...I am forwarding to jsp2 from jsp1.When the user clicks Back button in Jsp2,it should not go back to JSP1. Is there any other options...
meely at 2007-6-29 0:11:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

I've looked into this, and can't see any way to do it in JavaScript - I don't think you can empty the History list (because of security concerns).

I dimly remember some HTML tag which defines when a page expires (so if you set it to a previous date, presumably the browser won't cache it?) but I may be dreaming on that one ;-)

...so, the only other option I can think of is the one I previously posted, where you don't let 'em have a back button to press!!

Let me know if you find any other solutions

M

artntek at 2007-6-29 0:11:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I have repeatedly tried to do this and had to eventually come up with a workaround.

I simple open JSP#1 in the popup window, with a link to jsp#2 with no link back....because the window does not have a back button, the user can only close window which will only send him back to the original window where he was before JSP#1 was brought up.

Kind of weird, but it did the job for me.

wmacey at 2007-6-29 0:11:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Hi tyr this ... In jsp 1 use this javascript....<script language="Javascript"> <!-- function window_onload() { window.history.forward(); } //--></script>
TPK at 2007-6-29 0:11:42 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Very sneaky, my friend - I like your style... ;-)
artntek at 2007-6-29 0:11:42 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

Hi !

In your situation I would do something like (you code it as you like ;-) ):

JSP1

-

If the previous page (must be something like "referrer") is different from JSP2, load the normal content.

Else goto JSP2.

JSP2

-

Hiding the back button seems quite useless to me, because I never use it myself !

Instead I use Alt + leftArrow (on windows and IE, I can't tell for other systems or browsers), or right click - back, so if others do the way I do, they'll be able to go to JSP1 anyway !

I hope this can help you in any way !

stephmor

stephmor at 2007-6-29 0:11:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
stephmor, FYI <ALT> + <leftButton> is the keyboard shotcut for the back button ...
shann0nw at 2007-6-29 0:11:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...