0

Is it possible to disable npapi plugins on key press. For example, if I don't want the plugin to load for some mime-type which it is registered for, then just by pressing Alt key(say) it would prevent the plugin from loading, without the need of disabling the plugin. Something similar is discussed here, but I don't know how to implement it. https://wiki.mozilla.org/NPAPI:AdvancedKeyHandling

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
adnan kamili
  • 8,967
  • 7
  • 65
  • 125

1 Answers1

2

That's not what the AKH spec is about; that's for a plugin to report to the browser whether or not it handled a key event, and to participate in the tab chain.

You can't prevent your plugin from loading on a keypress, but you could make its initialization check the state of the keyboard via OS APIs, and fail to initialize if a specific key is held down. That will probably confuse the page and/or the user though, and if you control the page it would be better to just make a way of toggling the creation of the plugin element on or off.

smorgan
  • 20,228
  • 3
  • 47
  • 55
  • How can we toggle the creation of the plugin element or prevent it from initialising, I am using firebreath – adnan kamili Aug 06 '13 at 10:50
  • I'm suggesting you should do it on the page side, in JS. As in, have something on the page either create the plugin node dynamically, or not. Having the plugin fail to initialize once created will be a poor user experience. – smorgan Aug 07 '13 at 04:10