473,847 Members | 1,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2461
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.go ogle.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.c om/groups?selm=abc 4d8b8.031121205 3.4be98d39%40po sting.google.co m>

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*****@litote s.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.javas cript 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
4937
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 Bils
3
4978
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 tons of examples of capturing keys in IE but *none* of them work for capturing Ctrl+S, Ctrl+F, Ctrl+P,etc or any key combination that has a binding in IE. Does anyone know how to do this?
2
6088
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 key alone, the KeyData value is 131089. But all the possibilities I'm finding in the Keys enumeration are the following: Keys.ControlKey = 17 Keys.Control = 131072 Keys.LControlKey = 162 Keys.RControlKey = 163
6
2273
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 PC, but has a significant number of Macs running OS X, too. Googling around quickly turns up IM Grabber for the PC, which would seem to be just what they need. But there is no equivalent to be found for OS X. So if anyone knows of any such...
3
5263
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 handler does not see the combination. Now this control is contained within another control which is contained within another. The top most control does see the CTRL+Z. I can easily pass down the key info, but why does the nested control see...
2
4261
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 PS2 keyboard jack, so to Windows, it's essentially just a keyboard. After the reader has finished reading the barcode, it sends out Ctrl + M (which I *think* is a carriage return). To capture the Ctrl + M, I configured an event handler for the
2
4774
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 one of the controls embedded in the tabControl has the focus. I'm doing this using the KeyDown event. However, when pressing the CTRL+C my computer sounds a beep - as in 'not allowed' beep. The capturing of the keycombination works fine, however,...
1
4916
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, that is Ctrl) and ,so the text was not copied. Is this a bug? anyone could help me to get resolve this problem.
2
3103
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
9892
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9734
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10991
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10718
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10347
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7888
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Duprť who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7061
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5725
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.