Hi All,
I want to disable Ctrl+N option from (File -> New -> Window(Ctrl+N) in
Internet Explorer) using javascript programming. I have searched lot on this
but couldn't able to find out good source on the same. Is there any API which
can support this feature and we can turn off (disable File Menu option) that
API using javascript programming. Can any one of you please provide the
resolution for the same or link to good article.
Regards & Thanks in Advance
Sachin Saki
.NET Developer - Capgemini, INDIA
Bob Barrows [MVP] - 29 Nov 2005 12:00 GMT
> Hi All,
>
[quoted text clipped - 5 lines]
> any one of you please provide the resolution for the same or link to
> good article.
It can't be done.
If you need the functionality of a Windows program, then write one using
your favorite language (VB, C++, etc). You cannot force a browser to behave
like a Windows application. The browser is controlled by the user, not the
programmer.
Oh, you can get part of the way there by creating an HTA (HTML Application),
but that has its own issues.
Bob Barrows

Signature
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
davehagemann@gmail.com - 06 Dec 2005 04:22 GMT
Sachin,
You can disable this keycode combination for a specific web application
using javascript. However, the user will still be able to access this
same action via the File menu. But you could solve this by hiding the
menubar as well and providing your own customized menu. Here's an
example of how to catch and suppress the keycode combination Ctrl+N:
<script language="javascript">
<!--
document.onkeydown =
function KeyDownHandler(e)
{
// Ctrl key was pressed
if (event.ctrlKey)
{
// supports multiple browsers
var keyCode =
document.layers ? e.which :
document.all ? event.keyCode :
document.getElementById ? e.keyCode : 0;
// N key was pressed
if (keyCode == 78)
{
event.returnValue = false;
event.cancel = true;
alert("Ctrl + N was pressed");
}
}
}
// -->
</script>
As far as hiding the menubar and all of those tricks, I'll leave up to
you as I'm sure you'll be able to google that and find someone who has
done it. You could simply open a new window and hide it via the
window.open command.
Hope that helps.
- Dave
Mark Micallef - 22 Dec 2005 00:21 GMT
To hide the menu bar you need to deliver a hta instead of a html (htm).
There are permissions issues around this as essentially a good browser
should not allow a website to take control of it, and it'll depend to
some degree on the user's browser settings. You'll probably need to
apply a variety of techniques to achieve this level of lockdown, so get
creative.
Cheers,
Mark
>Sachin,
>You can disable this keycode combination for a specific web application
[quoted text clipped - 35 lines]
>
>