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: [EMAIL PROTECTED]
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" <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------
> Yahoo! Mail
> Bring photos to life! New PhotoMail  makes sharing a breeze.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to