I have a web page where I'd like to remap Ctrl+N to a different behavior. I followed YUI's example of register Key Listeners and my function is called but Firefox still creates a new browser window. Things seem to work fine on IE7. How do I stop the new window from showing up?
Example:
var kl2 = new YAHOO.util.KeyListener(document, { ctrl:true, keys:78 },
{fn:function(event) {
YAHOO.util.Event.stopEvent(event); // Doesn't help
alert('Click');}});
kl2.enable();
It is possible to remove default behavior. Google Docs overrides Ctrl+S to save your document instead of bringing up Firefox's save dialog. I tried the example above with Ctrl+S but Firefox's save dialog still pops up. Since Google can stop the save dialog from coming up I'm sure there's a way to prevent most default keyboard shortcuts.