Why does navigator.appCodeName return Mozilla?

后端 未结 4 1710
南笙
南笙 2020-12-05 17:30

The following JavaScript code returns \"Mozilla\" on all browsers. Why?

 

        
4条回答
  •  春和景丽
    2020-12-05 18:24

    Many years ago, developers used browser detection to reject other browsers, usually favouring Netscape Navigator (precursor to Mozilla and Firefox, also codenamed Mozilla). They tested for the string 'Mozilla' in the user agent. Internet Explorer got angsty and decided to imitate Netscape so they could join in on the fun.

提交回复
热议问题