Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Java Script or Java - Diasble ALT-TAB Key

Featured Replies

Hi,

I am working on a Project in which the User should not Switch on to any toher application other than mine. I want to disable certain keys like Windows Key and Alt-Tab Combination key. How would I make it Possible.

The Code can be in Java or Java Script.

  • 2 weeks later...

good luck with that one...

just a question??? why would you possibly want to do that?

-neo

(I am pretty sure it is not possible)

I do know that its possible...

But just see that the site it results in doesn't start to annoy normal usage. Because, I remember a site which did this:

Has a field where you enter case number (its a legal services site). If you used the "Back" arrow key to correct it, it immediately popped up a dialog-box -

Please enter a number between -blah-blah-blah-
And it did this every-time I pressed an arrow-key or a back-space. I HAD to use the mouse to get the cursor to where I wanted. That really was one annoying experience.

Uh, that isn't the same thing at all, that's just normal form validation (comparing keystrokes with a allowed keystrokes and with a mask) - gone bad (bad implementation). It's an event of the textbox or whatever that had the focus, and no, they don't have events fot alt-tab. There are ways to prevent a user from switching tasks - but not this way (I don't know your setup - nor why/how you want to do this)

  • 3 weeks later...
  • Author

Well Friends,

let me tell you why I want to do this, Just open any Form and Press ALT-TAB Keys Simultaneously. You will Come to One More Window Right All that I need is I dont want user to Pass from MY WINDOW to other window unless he closes it, I know it is Possible and also Done in many Sites.

  • 1 month later...

ALT+TAB is something inherent to the Windows Operating System and is completely out of reach for JavaScript or any other scripting language :whistle:

(and even any programming language as far as I remember).

there is a way however to return a message to the user when he presses a key when you don't want him to do that :thumbup

<script text="textjavascript"> 
function detect() {
               var pressKey = String.fromCharCode(event.keyCode);
               if (event.altKey) { alert('hello realguru');
               }
};
</script>
<body onkeydown="detect()">

Just detect the onKeyDown event and look for the keycode (event.keycode) or (event.altKey) and either process a return value of false .. or remap the key to some other key.

This is just a scribble, and wouldnt work in NN, or maybe even mozilla firefox because those browsers require a convoluted script to trap and process the onkeydown event.

too tired now to even explain that

I can't think of one good reason for disabling that key :rolleyes:

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.