最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - what browser is document.layers sniffing? - Stack Overflow

programmeradmin2浏览0评论

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

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

Share Improve this question edited Apr 23, 2010 at 18:30 Jon Seigel 12.4k8 gold badges60 silver badges93 bronze badges asked Jan 13, 2010 at 20:48 mkoryakmkoryak 57.9k64 gold badges203 silver badges262 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 16

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)

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.

发布评论

评论列表(0)

  1. 暂无评论