Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

overriding Ctrl-S for use in Javascript

221 views
Skip to first unread message

Bill Higgins

unread,
Feb 9, 2007, 1:56:21 PM2/9/07
to
I'd like to bind the Ctrl-S keydown event to result in saving a form written
in Javascript. However, whenever I do this, the Firefox browser binding
opens the "Save As" dialog.

Is there any way to programmatically prevent the Ctrl-S dialog from opening
the Save As dialog?

I tried to capture the event as it bubbled up from within the form and then
called evt.stopPropagation() on it, but no luck.


Daniel Brooks

unread,
Feb 10, 2007, 10:10:53 PM2/10/07
to
"Bill Higgins" <bhig...@us.ibm.com> writes:

No, a webpage cannot override the browser's keyboard shortcuts.

db48x

Bill Higgins

unread,
Mar 21, 2007, 1:54:59 AM3/21/07
to
FYI, I was able to override Ctrl-S (and you can use Ctrl-S in Gmail as
well).

Basically it only works if the Ctrl-S is pressed in a form element (select,
input, textarea) and you just have to clobber the DOM event. You can find
code for doing this on page 433 of Javascript the Definitive Guide, 5th Ed.
(the block that begins with the comment 'Stop the event from
propagating...')

"Daniel Brooks" <dan...@mozdevgroup.com> wrote in message
news:m31wkxw...@db48x.waldenweb.com...

0 new messages