views:

60

answers:

2

I am looking at some JS code from the 20th century, and they are using document.layers in code that is trying to get the current key code. What browser are they sniffing for?

i am about to replace the code with something like this:

var fn = function(event){
  event = event || window.event;
  var code = event.charCode || event.keyCode;
}

but i am afraid of breaking something arcane and releasing the evil

+3  A: 

document.layers exists in Netscape 4 and holds all <layer> and <ilayer> elements.
It was an early precursor to true DHTML.

For more information, see here. (Ten years old)

SLaks
"Gee, Mr. Peabody, this code is really old and crufty. Is it from ancient Babylonia?" ... "Sherman! Quick! To the WayBack Machine! We must save civilization from the BLINK tag!" ... "Gasp!" Stay tuned for next week's exciting episode.
Peter Rowell
my JVM ran out of memory after i made the replacement with newer code, hopefully that will be the extent of the arcane evil.
mkoryak
Firefox crashed when you replaced some Javascript? How could that happen?
SLaks
nope, it wasnt the jvm, firefox crashed in the evil way where it appears to be running but isnt.
mkoryak
not when i replaced some javascript, but when i replaced some _utterly evil_ javascript.
mkoryak
The Javascript you replaced shouldn't make a difference. What (and where) was it?
SLaks
you obviously have never dealt with code is so evil that it defies normal logic. Such code was written when you were 8 years old
mkoryak
+2  A: 

Netscape 4 is not able to display any modern web-page due to it's total lack of CSS support - so if you drop the support for this browser then you are not breaking anything that isnt already broken.

Andris