Looks like Opera/Mac does not let you override an action when user pressed ⌘S (the default is, of course, save page). I found out my old script doesn’t work in it. It saves the form contents to server via Ajax.
Here’s an onkey* handler:
key = ev.keyCode
if (!key) key = ev.charCode
if (ev.type == 'keypress' && 115 == key && ev.ctrlKey) return false
if (83 == key && ev.ctrlKey) {
if (ev.type != 'keypress') save_text ()
return false
}
The first weirdness of Opera/Mac is that it generates ctrlKey on ⌘ key instead of actual Ctrl
key. So in Safari this one works perfectly replacing standard ^S action with mine. But in Opera it ignores ^S completely, since ctrlKey is ⌘ for it, but ⌘S brings the standard Save dialog no matter what you do.
I was trying to actually monitor all the key* event sequence in Opera when I press ⌘S and it’s keydown with keyCode 17, then keypress with keyCode 17, and both happen after I press ⌘. No event at all is generated after I press S.
So it looks like I’m out of luck. Anyone has an idea how to force Opera to let me override ⌘S? :-)