You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Frank W. Zammetti" <fz...@omnytex.com> on 2006/03/14 00:51:43 UTC

[OT] Re: Browser back button

Marked OT... this isn't Struts-related...

There isn't any way to do it cross-browser that I am aware of, and there 
isn't any way to do it definitively.  However, because you say you are 
working on an Intranet application, you may have some options that you 
otherwise might not...

First thing, spawn a new window for you app with no chrome.  This will 
remove the Back button, and the menus that will allow you to access it, 
leaving just keyboard shortcuts.

If you can develop for IE-only, here's something I have found works... 
throw this in your onLoad handler...

document.onkeydown=function(e){if(event.srcElement.type=='text'||event.srcElement.type=='textarea'){return 
true;}else{return false;}};

This will block the back shortcut.  Amazingly, it also seems to block 
reload, and mouse clicks (i.e., if you have the middle mouse button 
mapped to back, as I do).  In other words, it seems to pretty well block 
  everything that you might be interested in blocking :)  But again, it 
is IE-only.

Don't forget too that many will argue that this is terrible web design. 
  I happen to disagree, but there are very reasonable arguments to make 
that this is a bad idea.  Make sure it's what you really want and need.

Frank

struts lover wrote:
> Hi,
>   
> I am using Struts and Tiles for an intranet application. I want to disable the back button.
>    
>   How can I achieve this?
>    
>   Any help would be appreciated.
>    
>   Thanks
> 
> 		
> ---------------------------------
>  Yahoo! Mail
>  Use Photomail to share photos without annoying attachments.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Browser back button

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
location.href will give you the same page... what you want is whatever 
the *real* initial page of your app is.  For instance, if right now you 
would go to index.jsp as the first page, then rename that to index1.jsp 
and use that as the argument.  The page I gave you would then become 
index.jsp.  Make sense?

Frank

struts lover wrote:
> Frank,
>   I again tried it and now it works. 
>   But what would be the argument to the window.open method.
>   I am using struts and tiles and all of my uri are like employee.do etc.
>    
>   I tried doing 
>   window.open(location.href, 'MYAPP', myOpts);
>   and it went into infinite loop.
>    
>   Any further help will be highly appreciated.
>    
>   Thanks.
> 
> "Frank W. Zammetti" <fz...@omnytex.com> wrote:
>   What doesn't work? And what are you trying to accomplish with
> history.forward()?
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Browser back button

Posted by struts lover <st...@yahoo.com>.
Frank,
  I again tried it and now it works. 
  But what would be the argument to the window.open method.
  I am using struts and tiles and all of my uri are like employee.do etc.
   
  I tried doing 
  window.open(location.href, 'MYAPP', myOpts);
  and it went into infinite loop.
   
  Any further help will be highly appreciated.
   
  Thanks.

"Frank W. Zammetti" <fz...@omnytex.com> wrote:
  What doesn't work? And what are you trying to accomplish with
history.forward()?

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

On Tue, March 14, 2006 3:11 pm, struts lover said:
> Hi Frank,
>
> I tried it but could not make it work. Also I am trying something like
> this.
>
>  
>   history.forward();
>      
>
> This also doesnt work. I am using Tiles.
>
> Thanks.
>
>
>
> "Frank W. Zammetti" wrote:
> I should also mention, you will probably want to have a check in all
> other
> pages/Actions that looks for some session variable that only gets sets on
> this page... if it isn't found, redirect here. That way, people can't
> jump into any page in your app they want.
>
> And again, I have to say, some people really disagree with things like
> this because it runs counter to "typical" web development. Make sure it's
> appropriate for your situation and environment before tossing out the
> prevailing wisdom like this.
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM: fzammetti
> Yahoo: fzammetti
> MSN: fzammetti@hotmail.com
> Java Web Parts -
> http://javawebparts.sourceforge.net
> Supplying the wheel, so you don't have to reinvent it!
>
> On Tue, March 14, 2006 12:00 pm, Frank W. Zammetti said:
>> You have to open your application in a chromeless window. Since you said
>> the Javascript solved your keyboard problem, you are obviously working
>> in
>> an IE-only environment, so here's how to do it... Your app must start
>> with
>> a single page, say index.jsp, which will be:
>>
>>
>>
>>
>>
>>
>> function openWindow() {
>> var agt = navigator.userAgent.toLowerCase();
>> var isMajor = parseInt(navigator.appVersion);
>> var isMinor = parseFloat(navigator.appVersion);
>> var isIE = ((agt.indexOf("msie") != -1) & (agt.indexOf("opera") ==
>> -1));
>> var isIE3 = (isIE & (isMajor > var isIE4 = (isIE & (isMajor ==
>> 4) & (agt.indexOf("msie 4") != -1)
>> );
>> var isIE5 = (isIE & (isMajor == 4) & (agt.indexOf("msie 5.0") != -1)
>> );
>> var isIE55Up = (isIE & !isIE3 & !isIE4 & !isIE5);
>> if (isIE55Up) {
>> strContent = "";
>> strContent = strContent + "
> ";
>> strContent = strContent + " > " +
>> "cellspacing=\"2\" border=\"2\" align=\"center\">";
>> strContent = strContent + " ";
>> strContent = strContent + " ";
>> strContent = strContent +
>> "New window should be open, you can do what you want with this
>> one.";
>> strContent = strContent + " ";
>> strContent = strContent + " ";
>> strContent = strContent + " ";
>> document.getElementById("Content").innerHTML = strContent;
>> desiredWidth = 1180;
>> desiredHeight = 936;
>> myLeft = (screen.width) ? (screen.width - desiredWidth ) / 2 : 0;
>> myTop = (screen.height) ? (screen.height - desiredHeight ) / 2 :
>> 0;
>> myOpts = "resizable,scrollbars,width=desiredWidth
>> ,height=desiredHeight ,top=" + myTop +
>> ",left=" + myLeft + ",";
>> window.open('index1.jsp', 'MYAPP', myOpts);
>> }
>> }
>>
>>
>>
>>
>>
>
>> > align="center">
>>
>>
>> Your browser is not IE, or Javascript is not enabled. Either way, go
>> away!
>>
>>
>>
>>
>
>>
>>
>>
>> Change desiredWidth and desiredHeight to the size you want the window to
>> be. This will open index1.jsp into a new window with no buttons, menus,
>> status bar, etc. This also centers the window upon opening it, something
>> I generally like. It also ensures the browser is IE 5.5 or higher. You
>> can change that accordingly if you need to support older versions, or
>> want
>> to further limit it to 6.0+ for instance.
>>
>> That's all there is to it... this, plus the Javascript from yesterday,
>> gets you about as close to full control as you can probably reasonably
>> hope to get. As long as your OK in an IE-only world, it's pretty nice.
>> I'm sure it's not fullproof, but it's more than adequate for typical
>> users. Throw in a right-click blocking function and it's pretty good.
>>
>> (If anyone can duplicate both these things with FF, that would be
>> fantastic... the chromeless window probably isn't a big deal, but my gut
>> tells me blocking the back functionality wouldn't be as easy, if
>> possible
>> at all).
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>> AIM: fzammetti
>> Yahoo: fzammetti
>> MSN: fzammetti@hotmail.com
>> Java Web Parts -
>> http://javawebparts.sourceforge.net
>> Supplying the wheel, so you don't have to reinvent it!
>>
>> On Tue, March 14, 2006 11:37 am, struts lover said:
>>> Hi Frank,
>>>
>>> Thanks for your reply. That solves my problem of back button or other
>>> key on the keyboard. But I still have the problem with the browser back
>>> button. I am using Tiles.
>>>
>>> It would be nice if you can provide any pointers.
>>>
>>> Thanks.
>>>
>>> "Frank W. Zammetti" wrote:
>>> Marked OT... this isn't Struts-related...
>>>
>>> There isn't any way to do it cross-browser that I am aware of, and
>>> there
>>> isn't any way to do it definitively. However, because you say you are
>>> working on an Intranet application, you may have some options that you
>>> otherwise might not...
>>>
>>> First thing, spawn a new window for you app with no chrome. This will
>>> remove the Back button, and the menus that will allow you to access it,
>>> leaving just keyboard shortcuts.
>>>
>>> If you can develop for IE-only, here's something I have found works...
>>> throw this in your onLoad handler...
>>>
>>> document.onkeydown=function(e){if(event.srcElement.type=='text'||event.srcElement.type=='textarea'){return
>>> true;}else{return false;}};
>>>
>>> This will block the back shortcut. Amazingly, it also seems to block
>>> reload, and mouse clicks (i.e., if you have the middle mouse button
>>> mapped to back, as I do). In other words, it seems to pretty well block
>>> everything that you might be interested in blocking :) But again, it
>>> is IE-only.
>>>
>>> Don't forget too that many will argue that this is terrible web design.
>>> I happen to disagree, but there are very reasonable arguments to make
>>> that this is a bad idea. Make sure it's what you really want and need.
>>>
>>> Frank
>>>
>>> struts lover wrote:
>>>> Hi,
>>>>
>>>> I am using Struts and Tiles for an intranet application. I want to
>>>> disable the back button.
>>>>
>>>> How can I achieve this?
>>>>
>>>> Any help would be appreciated.
>>>>
>>>> Thanks
>>>>
>>>>
>>>> ---------------------------------
>>>> Yahoo! Mail
>>>> Use Photomail to share photos without annoying attachments.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>
>>> ---------------------------------
>>> Yahoo! Mail
>>> Bring photos to life! New PhotoMail makes sharing a breeze.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



		
---------------------------------
Yahoo! Travel
 Find  great deals to the top 10 hottest destinations!

Re: [OT] Re: Browser back button

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
What doesn't work?  And what are you trying to accomplish with
history.forward()?

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

On Tue, March 14, 2006 3:11 pm, struts lover said:
> Hi Frank,
>
>   I tried it but could not make it work. Also I am trying something like
> this.
>
>   <script>
>   history.forward();
>   </script>
>
>   This also doesnt work. I am using Tiles.
>
>   Thanks.
>
>
>
> "Frank W. Zammetti" <fz...@omnytex.com> wrote:
>   I should also mention, you will probably want to have a check in all
> other
> pages/Actions that looks for some session variable that only gets sets on
> this page... if it isn't found, redirect here. That way, people can't
> jump into any page in your app they want.
>
> And again, I have to say, some people really disagree with things like
> this because it runs counter to "typical" web development. Make sure it's
> appropriate for your situation and environment before tossing out the
> prevailing wisdom like this.
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM: fzammetti
> Yahoo: fzammetti
> MSN: fzammetti@hotmail.com
> Java Web Parts -
> http://javawebparts.sourceforge.net
> Supplying the wheel, so you don't have to reinvent it!
>
> On Tue, March 14, 2006 12:00 pm, Frank W. Zammetti said:
>> You have to open your application in a chromeless window. Since you said
>> the Javascript solved your keyboard problem, you are obviously working
>> in
>> an IE-only environment, so here's how to do it... Your app must start
>> with
>> a single page, say index.jsp, which will be:
>>
>>
>>
>>
>>
>>
>>   function openWindow() {
>>     var agt = navigator.userAgent.toLowerCase();
>>     var isMajor = parseInt(navigator.appVersion);
>>     var isMinor = parseFloat(navigator.appVersion);
>>     var isIE = ((agt.indexOf("msie") != -1) & (agt.indexOf("opera") ==
>> -1));
>>     var isIE3 = (isIE & (isMajor >     var isIE4 = (isIE & (isMajor ==
>> 4) & (agt.indexOf("msie 4") != -1)
>> );
>>     var isIE5 = (isIE & (isMajor == 4) & (agt.indexOf("msie 5.0") != -1)
>> );
>>     var isIE55Up = (isIE & !isIE3 & !isIE4 & !isIE5);
>>     if (isIE55Up) {
>>       strContent = "";
>>       strContent = strContent + "
> ";
>>       strContent = strContent + " > " +
>>         "cellspacing=\"2\" border=\"2\" align=\"center\">";
>>       strContent = strContent + "  ";
>>       strContent = strContent + "   ";
>>       strContent = strContent +
>>         "New window should be open, you can do what you want with this
>> one.";
>>       strContent = strContent + "   ";
>>       strContent = strContent + "  ";
>>       strContent = strContent + " ";
>>       document.getElementById("Content").innerHTML = strContent;
>>       desiredWidth = 1180;
>>       desiredHeight = 936;
>>       myLeft = (screen.width) ? (screen.width - desiredWidth ) / 2 : 0;
>>       myTop = (screen.height) ? (screen.height - desiredHeight ) / 2 :
>> 0;
>>       myOpts = "resizable,scrollbars,width=desiredWidth
>> ,height=desiredHeight ,top=" + myTop +
>>         ",left=" + myLeft + ",";
>>       window.open('index1.jsp', 'MYAPP', myOpts);
>>     }
>>   }
>>
>>
>>
>>
>>
>
>>   > align="center">
>>
>>
>> Your browser is not IE, or Javascript is not enabled. Either way, go
>> away!
>>
>>
>>
>>
>
>>
>>
>>
>> Change desiredWidth and desiredHeight to the size you want the window to
>> be. This will open index1.jsp into a new window with no buttons, menus,
>> status bar, etc. This also centers the window upon opening it, something
>> I generally like. It also ensures the browser is IE 5.5 or higher. You
>> can change that accordingly if you need to support older versions, or
>> want
>> to further limit it to 6.0+ for instance.
>>
>> That's all there is to it... this, plus the Javascript from yesterday,
>> gets you about as close to full control as you can probably reasonably
>> hope to get. As long as your OK in an IE-only world, it's pretty nice.
>> I'm sure it's not fullproof, but it's more than adequate for typical
>> users. Throw in a right-click blocking function and it's pretty good.
>>
>> (If anyone can duplicate both these things with FF, that would be
>> fantastic... the chromeless window probably isn't a big deal, but my gut
>> tells me blocking the back functionality wouldn't be as easy, if
>> possible
>> at all).
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>> AIM: fzammetti
>> Yahoo: fzammetti
>> MSN: fzammetti@hotmail.com
>> Java Web Parts -
>> http://javawebparts.sourceforge.net
>> Supplying the wheel, so you don't have to reinvent it!
>>
>> On Tue, March 14, 2006 11:37 am, struts lover said:
>>> Hi Frank,
>>>
>>> Thanks for your reply. That solves my problem of back button or other
>>> key on the keyboard. But I still have the problem with the browser back
>>> button. I am using Tiles.
>>>
>>> It would be nice if you can provide any pointers.
>>>
>>> Thanks.
>>>
>>> "Frank W. Zammetti" wrote:
>>> Marked OT... this isn't Struts-related...
>>>
>>> There isn't any way to do it cross-browser that I am aware of, and
>>> there
>>> isn't any way to do it definitively. However, because you say you are
>>> working on an Intranet application, you may have some options that you
>>> otherwise might not...
>>>
>>> First thing, spawn a new window for you app with no chrome. This will
>>> remove the Back button, and the menus that will allow you to access it,
>>> leaving just keyboard shortcuts.
>>>
>>> If you can develop for IE-only, here's something I have found works...
>>> throw this in your onLoad handler...
>>>
>>> document.onkeydown=function(e){if(event.srcElement.type=='text'||event.srcElement.type=='textarea'){return
>>> true;}else{return false;}};
>>>
>>> This will block the back shortcut. Amazingly, it also seems to block
>>> reload, and mouse clicks (i.e., if you have the middle mouse button
>>> mapped to back, as I do). In other words, it seems to pretty well block
>>> everything that you might be interested in blocking :) But again, it
>>> is IE-only.
>>>
>>> Don't forget too that many will argue that this is terrible web design.
>>> I happen to disagree, but there are very reasonable arguments to make
>>> that this is a bad idea. Make sure it's what you really want and need.
>>>
>>> Frank
>>>
>>> struts lover wrote:
>>>> Hi,
>>>>
>>>> I am using Struts and Tiles for an intranet application. I want to
>>>> disable the back button.
>>>>
>>>> How can I achieve this?
>>>>
>>>> Any help would be appreciated.
>>>>
>>>> Thanks
>>>>
>>>>
>>>> ---------------------------------
>>>> Yahoo! Mail
>>>> Use Photomail to share photos without annoying attachments.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>
>>> ---------------------------------
>>> Yahoo! Mail
>>> Bring photos to life! New PhotoMail makes sharing a breeze.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Browser back button

Posted by struts lover <st...@yahoo.com>.
Hi Frank,
   
  I tried it but could not make it work. Also I am trying something like this.
   
  <script>
  history.forward();
  </script>
   
  This also doesnt work. I am using Tiles.
   
  Thanks.
   
  

"Frank W. Zammetti" <fz...@omnytex.com> wrote:
  I should also mention, you will probably want to have a check in all other
pages/Actions that looks for some session variable that only gets sets on
this page... if it isn't found, redirect here. That way, people can't
jump into any page in your app they want.

And again, I have to say, some people really disagree with things like
this because it runs counter to "typical" web development. Make sure it's
appropriate for your situation and environment before tossing out the
prevailing wisdom like this.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

On Tue, March 14, 2006 12:00 pm, Frank W. Zammetti said:
> You have to open your application in a chromeless window. Since you said
> the Javascript solved your keyboard problem, you are obviously working in
> an IE-only environment, so here's how to do it... Your app must start with
> a single page, say index.jsp, which will be:
>
> 
> 
> 
> 
>  
>   function openWindow() {
>     var agt = navigator.userAgent.toLowerCase();
>     var isMajor = parseInt(navigator.appVersion);
>     var isMinor = parseFloat(navigator.appVersion);
>     var isIE = ((agt.indexOf("msie") != -1) & (agt.indexOf("opera") ==
> -1));
>     var isIE3 = (isIE & (isMajor >     var isIE4 = (isIE & (isMajor == 4) & (agt.indexOf("msie 4") != -1)
> );
>     var isIE5 = (isIE & (isMajor == 4) & (agt.indexOf("msie 5.0") != -1)
> );
>     var isIE55Up = (isIE & !isIE3 & !isIE4 & !isIE5);
>     if (isIE55Up) {
>       strContent = "";
>       strContent = strContent + " 
";
>       strContent = strContent + " > " +
>         "cellspacing=\"2\" border=\"2\" align=\"center\">";
>       strContent = strContent + "  ";
>       strContent = strContent + "   ";
>       strContent = strContent +
>         "New window should be open, you can do what you want with this
> one.";
>       strContent = strContent + "   ";
>       strContent = strContent + "  ";
>       strContent = strContent + " ";
>       document.getElementById("Content").innerHTML = strContent;
>       desiredWidth = 1180;
>       desiredHeight = 936;
>       myLeft = (screen.width) ? (screen.width - desiredWidth ) / 2 : 0;
>       myTop = (screen.height) ? (screen.height - desiredHeight ) / 2 : 0;
>       myOpts = "resizable,scrollbars,width=desiredWidth
> ,height=desiredHeight ,top=" + myTop +
>         ",left=" + myLeft + ",";
>       window.open('index1.jsp', 'MYAPP', myOpts);
>     }
>   }
>    
> 
> 
>   
> 

>   > align="center">
>     
>   
> Your browser is not IE, or Javascript is not enabled. Either way, go
> away!
> 
> 
> 
> 

> 
> 
>
> Change desiredWidth and desiredHeight to the size you want the window to
> be. This will open index1.jsp into a new window with no buttons, menus,
> status bar, etc. This also centers the window upon opening it, something
> I generally like. It also ensures the browser is IE 5.5 or higher. You
> can change that accordingly if you need to support older versions, or want
> to further limit it to 6.0+ for instance.
>
> That's all there is to it... this, plus the Javascript from yesterday,
> gets you about as close to full control as you can probably reasonably
> hope to get. As long as your OK in an IE-only world, it's pretty nice.
> I'm sure it's not fullproof, but it's more than adequate for typical
> users. Throw in a right-click blocking function and it's pretty good.
>
> (If anyone can duplicate both these things with FF, that would be
> fantastic... the chromeless window probably isn't a big deal, but my gut
> tells me blocking the back functionality wouldn't be as easy, if possible
> at all).
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM: fzammetti
> Yahoo: fzammetti
> MSN: fzammetti@hotmail.com
> Java Web Parts -
> http://javawebparts.sourceforge.net
> Supplying the wheel, so you don't have to reinvent it!
>
> On Tue, March 14, 2006 11:37 am, struts lover said:
>> Hi Frank,
>>
>> Thanks for your reply. That solves my problem of back button or other
>> key on the keyboard. But I still have the problem with the browser back
>> button. I am using Tiles.
>>
>> It would be nice if you can provide any pointers.
>>
>> Thanks.
>>
>> "Frank W. Zammetti" wrote:
>> Marked OT... this isn't Struts-related...
>>
>> There isn't any way to do it cross-browser that I am aware of, and there
>> isn't any way to do it definitively. However, because you say you are
>> working on an Intranet application, you may have some options that you
>> otherwise might not...
>>
>> First thing, spawn a new window for you app with no chrome. This will
>> remove the Back button, and the menus that will allow you to access it,
>> leaving just keyboard shortcuts.
>>
>> If you can develop for IE-only, here's something I have found works...
>> throw this in your onLoad handler...
>>
>> document.onkeydown=function(e){if(event.srcElement.type=='text'||event.srcElement.type=='textarea'){return
>> true;}else{return false;}};
>>
>> This will block the back shortcut. Amazingly, it also seems to block
>> reload, and mouse clicks (i.e., if you have the middle mouse button
>> mapped to back, as I do). In other words, it seems to pretty well block
>> everything that you might be interested in blocking :) But again, it
>> is IE-only.
>>
>> Don't forget too that many will argue that this is terrible web design.
>> I happen to disagree, but there are very reasonable arguments to make
>> that this is a bad idea. Make sure it's what you really want and need.
>>
>> Frank
>>
>> struts lover wrote:
>>> Hi,
>>>
>>> I am using Struts and Tiles for an intranet application. I want to
>>> disable the back button.
>>>
>>> How can I achieve this?
>>>
>>> Any help would be appreciated.
>>>
>>> Thanks
>>>
>>>
>>> ---------------------------------
>>> Yahoo! Mail
>>> Use Photomail to share photos without annoying attachments.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>> ---------------------------------
>> Yahoo! Mail
>> Bring photos to life! New PhotoMail makes sharing a breeze.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: [OT] Re: Browser back button

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
I should also mention, you will probably want to have a check in all other
pages/Actions that looks for some session variable that only gets sets on
this page... if it isn't found, redirect here.  That way, people can't
jump into any page in your app they want.

And again, I have to say, some people really disagree with things like
this because it runs counter to "typical" web development.  Make sure it's
appropriate for your situation and environment before tossing out the
prevailing wisdom like this.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

On Tue, March 14, 2006 12:00 pm, Frank W. Zammetti said:
> You have to open your application in a chromeless window.  Since you said
> the Javascript solved your keyboard problem, you are obviously working in
> an IE-only environment, so here's how to do it... Your app must start with
> a single page, say index.jsp, which will be:
>
> <%@ page language="java" session="false" %>
> <html>
> <head>
> <title>My App</title>
> <script>
>   function openWindow() {
>     var agt = navigator.userAgent.toLowerCase();
>     var isMajor = parseInt(navigator.appVersion);
>     var isMinor = parseFloat(navigator.appVersion);
>     var isIE = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") ==
> -1));
>     var isIE3 = (isIE && (isMajor < 4));
>     var isIE4 = (isIE && (isMajor == 4) && (agt.indexOf("msie 4") != -1)
> );
>     var isIE5 = (isIE && (isMajor == 4) && (agt.indexOf("msie 5.0") != -1)
> );
>     var isIE55Up = (isIE && !isIE3 && !isIE4 && !isIE5);
>     if (isIE55Up) {
>       strContent = "";
>       strContent = strContent + " <br>";
>       strContent = strContent + " <table width=\"80%\" cellpadding=\"10\"
> " +
>         "cellspacing=\"2\" border=\"2\" align=\"center\">";
>       strContent = strContent + "  <tr>";
>       strContent = strContent + "   <td align=\"center\">";
>       strContent = strContent +
>         "New window should be open, you can do what you want with this
> one.";
>       strContent = strContent + "   </td>";
>       strContent = strContent + "  </tr>";
>       strContent = strContent + " </table>";
>       document.getElementById("Content").innerHTML = strContent;
>       desiredWidth = 1180;
>       desiredHeight = 936;
>       myLeft = (screen.width) ? (screen.width - desiredWidth ) / 2 : 0;
>       myTop = (screen.height) ? (screen.height - desiredHeight ) / 2 : 0;
>       myOpts = "resizable,scrollbars,width=desiredWidth
> ,height=desiredHeight ,top=" + myTop +
>         ",left=" + myLeft + ",";
>       window.open('index1.jsp', 'MYAPP', myOpts);
>     }
>   }
> </script>
> </head>
> <body onload="openWindow();">
> <div id="Content">
>  <br>
>  <table width="80%" cellpadding="10" cellspacing="2" border="2"
> align="center">
>   <tr>
>    <td align="center">
>     Your browser is not IE, or Javascript is not enabled.  Either way, go
> away!
>    </td>
>   </tr>
>  </table>
> </div>
> </body>
> </html>
>
> Change desiredWidth and desiredHeight to the size you want the window to
> be.  This will open index1.jsp into a new window with no buttons, menus,
> status bar, etc.  This also centers the window upon opening it, something
> I generally like.  It also ensures the browser is IE 5.5 or higher.  You
> can change that accordingly if you need to support older versions, or want
> to further limit it to 6.0+ for instance.
>
> That's all there is to it... this, plus the Javascript from yesterday,
> gets you about as close to full control as you can probably reasonably
> hope to get.  As long as your OK in an IE-only world, it's pretty nice.
> I'm sure it's not fullproof, but it's more than adequate for typical
> users.  Throw in a right-click blocking function and it's pretty good.
>
> (If anyone can duplicate both these things with FF, that would be
> fantastic... the chromeless window probably isn't a big deal, but my gut
> tells me blocking the back functionality wouldn't be as easy, if possible
> at all).
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM: fzammetti
> Yahoo: fzammetti
> MSN: fzammetti@hotmail.com
> Java Web Parts -
> http://javawebparts.sourceforge.net
> Supplying the wheel, so you don't have to reinvent it!
>
> On Tue, March 14, 2006 11:37 am, struts lover said:
>> Hi Frank,
>>
>>   Thanks for your reply. That solves my problem of back button or other
>> key on the keyboard. But I still have the problem with the browser back
>> button. I am using Tiles.
>>
>>   It would be nice if you can provide any pointers.
>>
>>   Thanks.
>>
>> "Frank W. Zammetti" <fz...@omnytex.com> wrote:
>>   Marked OT... this isn't Struts-related...
>>
>> There isn't any way to do it cross-browser that I am aware of, and there
>> isn't any way to do it definitively. However, because you say you are
>> working on an Intranet application, you may have some options that you
>> otherwise might not...
>>
>> First thing, spawn a new window for you app with no chrome. This will
>> remove the Back button, and the menus that will allow you to access it,
>> leaving just keyboard shortcuts.
>>
>> If you can develop for IE-only, here's something I have found works...
>> throw this in your onLoad handler...
>>
>> document.onkeydown=function(e){if(event.srcElement.type=='text'||event.srcElement.type=='textarea'){return
>> true;}else{return false;}};
>>
>> This will block the back shortcut. Amazingly, it also seems to block
>> reload, and mouse clicks (i.e., if you have the middle mouse button
>> mapped to back, as I do). In other words, it seems to pretty well block
>> everything that you might be interested in blocking :) But again, it
>> is IE-only.
>>
>> Don't forget too that many will argue that this is terrible web design.
>> I happen to disagree, but there are very reasonable arguments to make
>> that this is a bad idea. Make sure it's what you really want and need.
>>
>> Frank
>>
>> struts lover wrote:
>>> Hi,
>>>
>>> I am using Struts and Tiles for an intranet application. I want to
>>> disable the back button.
>>>
>>> How can I achieve this?
>>>
>>> Any help would be appreciated.
>>>
>>> Thanks
>>>
>>>
>>> ---------------------------------
>>> Yahoo! Mail
>>> Use Photomail to share photos without annoying attachments.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>> ---------------------------------
>> Yahoo! Mail
>> Bring photos to life! New PhotoMail  makes sharing a breeze.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Browser back button

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
You have to open your application in a chromeless window.  Since you said
the Javascript solved your keyboard problem, you are obviously working in
an IE-only environment, so here's how to do it... Your app must start with
a single page, say index.jsp, which will be:

<%@ page language="java" session="false" %>
<html>
<head>
<title>My App</title>
<script>
  function openWindow() {
    var agt = navigator.userAgent.toLowerCase();
    var isMajor = parseInt(navigator.appVersion);
    var isMinor = parseFloat(navigator.appVersion);
    var isIE = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var isIE3 = (isIE && (isMajor < 4));
    var isIE4 = (isIE && (isMajor == 4) && (agt.indexOf("msie 4") != -1) );
    var isIE5 = (isIE && (isMajor == 4) && (agt.indexOf("msie 5.0") != -1) );
    var isIE55Up = (isIE && !isIE3 && !isIE4 && !isIE5);
    if (isIE55Up) {
      strContent = "";
      strContent = strContent + " <br>";
      strContent = strContent + " <table width=\"80%\" cellpadding=\"10\" " +
        "cellspacing=\"2\" border=\"2\" align=\"center\">";
      strContent = strContent + "  <tr>";
      strContent = strContent + "   <td align=\"center\">";
      strContent = strContent +
        "New window should be open, you can do what you want with this one.";
      strContent = strContent + "   </td>";
      strContent = strContent + "  </tr>";
      strContent = strContent + " </table>";
      document.getElementById("Content").innerHTML = strContent;
      desiredWidth = 1180;
      desiredHeight = 936;
      myLeft = (screen.width) ? (screen.width - desiredWidth ) / 2 : 0;
      myTop = (screen.height) ? (screen.height - desiredHeight ) / 2 : 0;
      myOpts = "resizable,scrollbars,width=desiredWidth
,height=desiredHeight ,top=" + myTop +
        ",left=" + myLeft + ",";
      window.open('index1.jsp', 'MYAPP', myOpts);
    }
  }
</script>
</head>
<body onload="openWindow();">
<div id="Content">
 <br>
 <table width="80%" cellpadding="10" cellspacing="2" border="2"
align="center">
  <tr>
   <td align="center">
    Your browser is not IE, or Javascript is not enabled.  Either way, go
away!
   </td>
  </tr>
 </table>
</div>
</body>
</html>

Change desiredWidth and desiredHeight to the size you want the window to
be.  This will open index1.jsp into a new window with no buttons, menus,
status bar, etc.  This also centers the window upon opening it, something
I generally like.  It also ensures the browser is IE 5.5 or higher.  You
can change that accordingly if you need to support older versions, or want
to further limit it to 6.0+ for instance.

That's all there is to it... this, plus the Javascript from yesterday,
gets you about as close to full control as you can probably reasonably
hope to get.  As long as your OK in an IE-only world, it's pretty nice. 
I'm sure it's not fullproof, but it's more than adequate for typical
users.  Throw in a right-click blocking function and it's pretty good.

(If anyone can duplicate both these things with FF, that would be
fantastic... the chromeless window probably isn't a big deal, but my gut
tells me blocking the back functionality wouldn't be as easy, if possible
at all).

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

On Tue, March 14, 2006 11:37 am, struts lover said:
> Hi Frank,
>
>   Thanks for your reply. That solves my problem of back button or other
> key on the keyboard. But I still have the problem with the browser back
> button. I am using Tiles.
>
>   It would be nice if you can provide any pointers.
>
>   Thanks.
>
> "Frank W. Zammetti" <fz...@omnytex.com> wrote:
>   Marked OT... this isn't Struts-related...
>
> There isn't any way to do it cross-browser that I am aware of, and there
> isn't any way to do it definitively. However, because you say you are
> working on an Intranet application, you may have some options that you
> otherwise might not...
>
> First thing, spawn a new window for you app with no chrome. This will
> remove the Back button, and the menus that will allow you to access it,
> leaving just keyboard shortcuts.
>
> If you can develop for IE-only, here's something I have found works...
> throw this in your onLoad handler...
>
> document.onkeydown=function(e){if(event.srcElement.type=='text'||event.srcElement.type=='textarea'){return
> true;}else{return false;}};
>
> This will block the back shortcut. Amazingly, it also seems to block
> reload, and mouse clicks (i.e., if you have the middle mouse button
> mapped to back, as I do). In other words, it seems to pretty well block
> everything that you might be interested in blocking :) But again, it
> is IE-only.
>
> Don't forget too that many will argue that this is terrible web design.
> I happen to disagree, but there are very reasonable arguments to make
> that this is a bad idea. Make sure it's what you really want and need.
>
> Frank
>
> struts lover wrote:
>> Hi,
>>
>> I am using Struts and Tiles for an intranet application. I want to
>> disable the back button.
>>
>> How can I achieve this?
>>
>> Any help would be appreciated.
>>
>> Thanks
>>
>>
>> ---------------------------------
>> Yahoo! Mail
>> Use Photomail to share photos without annoying attachments.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> ---------------------------------
> Yahoo! Mail
> Bring photos to life! New PhotoMail  makes sharing a breeze.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Browser back button

Posted by struts lover <st...@yahoo.com>.
Hi Frank,
   
  Thanks for your reply. That solves my problem of back button or other key on the keyboard. But I still have the problem with the browser back button. I am using Tiles.
   
  It would be nice if you can provide any pointers.
   
  Thanks.

"Frank W. Zammetti" <fz...@omnytex.com> wrote:
  Marked OT... this isn't Struts-related...

There isn't any way to do it cross-browser that I am aware of, and there 
isn't any way to do it definitively. However, because you say you are 
working on an Intranet application, you may have some options that you 
otherwise might not...

First thing, spawn a new window for you app with no chrome. This will 
remove the Back button, and the menus that will allow you to access it, 
leaving just keyboard shortcuts.

If you can develop for IE-only, here's something I have found works... 
throw this in your onLoad handler...

document.onkeydown=function(e){if(event.srcElement.type=='text'||event.srcElement.type=='textarea'){return 
true;}else{return false;}};

This will block the back shortcut. Amazingly, it also seems to block 
reload, and mouse clicks (i.e., if you have the middle mouse button 
mapped to back, as I do). In other words, it seems to pretty well block 
everything that you might be interested in blocking :) But again, it 
is IE-only.

Don't forget too that many will argue that this is terrible web design. 
I happen to disagree, but there are very reasonable arguments to make 
that this is a bad idea. Make sure it's what you really want and need.

Frank

struts lover wrote:
> Hi,
> 
> I am using Struts and Tiles for an intranet application. I want to disable the back button.
> 
> How can I achieve this?
> 
> Any help would be appreciated.
> 
> Thanks
> 
> 
> ---------------------------------
> Yahoo! Mail
> Use Photomail to share photos without annoying attachments.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



		
---------------------------------
Yahoo! Mail
Bring photos to life! New PhotoMail  makes sharing a breeze.