The altGraphKey in webkit browsers no longer appears to exist (as at September 2013) and the behaviour of Firefox has changed. Browser behaviours for the AltGr key currently appear to be:
- Webkit (Chrome) - ctrlKey: true, altKey: true
- IE 8 - ctrlKey: false, altKey: true
- IE 10 - ctrlKey: true, altKey: true
- Mozilla (Firefox) - ctrlKey: true, altKey: true
Which is to say, they are all currently consistent (apart from IE8, which remains consistently inconsistent).
The following snippet should catch Alt Gr - but not Alt or Ctrl - in modern browsers. You will need a special case for IE8 however:
if (event.ctrlKey && event.altKey) {
// Appears to be Alt Gr
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…