0

Is it possible to prevent certain Keypresses (as mentioned int he title) from reaching the browser? Basically I want to strip down user's ability to close a browser window. Is it possible through NPAPI plugin, particularly in google-chrome web browser. The plugin will be developed using firebreath.

Juzer Ali
  • 4,109
  • 3
  • 35
  • 62
  • Your questions in the IRC room and here don't seem to reflect having read my response to your question on the google group; did you read it? https://groups.google.com/group/firebreath-dev/browse_thread/thread/f1d7a02f8d73352e – taxilian Sep 02 '12 at 02:25

1 Answers1

0

If your actual question is if the browsers give plugins a way to do this, the answer is absolutely not.

That said, there may be system APIs that you can use to do that, but you'd definitely be more likely to get help if you ask a question about how to do that using system APIs. The challenge will be finding a way to only do it when you're in the browser or on a specific tab, etc; there is no way through the browser to do this. If there is a way it'll be hackish and involve system calls, not plugin calls.

Also remember that plugins don't automatically instantiate; it would only work on a page with your object tag. http://npapi.com/extensions for more info

taxilian
  • 14,229
  • 4
  • 34
  • 73
  • Reproduced from google groups discussion: Hi Richard, Thanks for the quick reply. From whatever little I know so far of window management, I've come to following conclusions: 1. Alt+F4 is global key combination for closing a window, this event bubbles all the way up to the OS. (On my OS I know how to disable this key combination, or any kind of key combination from closing the window altogether). 2. Ctrl+W, Ctrl+F4 are application specific. These keypresses are handled by application and do not bubble up to OS. – Juzer Ali Sep 02 '12 at 03:43
  • I've disabled Alt+F4 on my system, guess what happens. Firefox does not get closed by using this key combination, on the other hand Google Chrome and Opera does gets closed. It seems Firefox defers the Alt+F4 key combination to OS but apparently Chrome and Opera do not. Hence my question is pertinent to plugins that if they can prevent certain keypresses from reaching the browser? I know for sure that they can capture the events, as pointed out in FBTestPlugin which illustrates how to capture mouse movements. The question is, can their propagation be stopped? – Juzer Ali Sep 02 '12 at 03:43
  • No, the browser doesn't give you its own events, only the ones that it thinks are destined for your plugin. In fact, this sounds like something that would actually be intentionally blocked by the browsers if they thought such a thing were possible. If you can't do it using system APIs, then you can't do it – taxilian Sep 02 '12 at 04:00
  • Ctrl+W and Ctrl+F4 are not really concerned with Systems API. They are application specific. But you are right in that it cannot be done using a plugin. The only way forward seems to be hacking with the browser's code. – Juzer Ali Sep 02 '12 at 05:30