"Pedro Graca" wrote:
Bilal wrote: Is there any way to capture the action Ctrl+N (whether it
in a hidden button or keyword - doesn't matter) in html,
javascript or php? I appreciate any suggestions.
HTML: no
PHP: no
javascript: I have no idea
In javascript the answer is yes and no. In IE, for example, if contents
of the document have focus (so are receiving keyboard input) then it is
possible to intercept Ctrl+N, but if the window has focus the keystrokes
go straight to the browser and scripts running in the document never get
to hear about them. Gecko browsers seem to allow all keystrokes to be
intercepted (though not necessarily cancelled) and Opera browsers tend
to keep their keyboard shortcuts entirely to themselves. So on the whole
it is probably not worth the effort to try to detect Ctrl-N as the
effort will predictably fail at least often enough to fail to address
whatever motivates the question.
The result of Ctrl-N in Windows IE is to open a new browser instance
(with full chrome) and showing the same page/URL as the old one (and
associated with the same user session), so the reason for asking this
question is usually a realisation that such an action will have harmful
consequences for a server-side system. But this is normal behaviour form
web browsers (and unavoidable) so the solution is to fix the server-side
code so that it can cope with the normal behaviour of client browsers.
Richard.