473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Capturing Ctrl N

Hi,
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.
Thank you and kind regards
Bils
Jul 17 '05 #1
5 2444
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

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2
"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.
Jul 17 '05 #3
bj****@hotmail.com (Bilal) wrote in message news:<f9**************************@posting.google. com>...
Hi,
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.


Sometime ago, we had a similar discussion
<http://groups.google.com/groups?selm=abc4d8b8.0311212053.4be98d39%40posting .google.com>

In short, in PHP there is no "direct" way of trapping the "Ctrl+N"
as it is server-side.

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #4
On Wed, 2 Jun 2004 10:43:48 +0000 (UTC), "Richard Cornford"
<ri*****@litotes.demon.co.uk> wrote:
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.


Er, so you can guess where people navigate too if they type in the
URL?

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 17 '05 #5
Jim Ley wrote:
Richard Cornford wrote:
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.


Er, so you can guess where people navigate too if they
type in the URL?


In principle I suppose you could, though it was some considerable time
ago I was testing this and there have been a lot of Mozilla releases in
the meanwhile (so it may no longer be true). And I didn’t try
specifically capturing keystrokes aimed at the location bar because I
was experimenting to see if there was any way of preventing the use of
bookmarked javascript URLs so removing the location and menu bars from
the window was the obvious first barrier to their use.

I remember at the time thinking that it was poor that Mozilla was
letting a script within a document intercept and cancel keyboard
shortcuts.

Richard.
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Bilal | last post by:
Hi, 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. Thank you and kind regards...
3
by: Greg | last post by:
I want to be able to capture the user pressing Ctrl+S. I know that the IE browser has a key binding for Ctrl+S but is there any way that I can be notified of this key press anyway. I have found...
2
by: Phil Galey | last post by:
I'm using the ProcessCmdKey event to capture various keys that are pressed. However, I'm having trouble capturing the combination of the CTRL key and, say, the DOWN key. If I just press the CTRL...
6
by: Ed Leafe | last post by:
I've been approached by a local business that has been advised that they need to start capturing and archiving their instant messaging in order to comply with Sarbanes-Oxley. The company is largely...
3
by: MLM450 | last post by:
I have a control that handles the KeyDown event but it does not seem to execute when a combination of keys is pressed - like CTRL+Z. If I press CTRL, it executes. If I press Z, it executes. But the...
2
by: senfo | last post by:
Hello all, To help alleviate human error, I'm developing an application that uses a barcode reader to fill in a value in a TextBox control. The barcode reader is connected to the PC through the...
2
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
I have a tabcontrol where I want to capture the CTRL+C key combination. My tabcontrol has on its tabpages some treeView controls. My intention is to intercept the event of pressing the CTRL+C when...
1
by: Sendil kumar | last post by:
When I do a Ctrl-C(copy) on a text, the text was not copied. By narrowing down the problem I found that VC++ message map is not capturing the Ctrl-C key press event(Only captures the first key press,...
2
by: John | last post by:
Hi How can I capture control keys Ctrl-A, Ctrl-B, Ctrl-C etc. in a form? Thanks Regards
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.