为什么 navigator.appCodeName 返回 Mozilla? [英] Why does navigator.appCodeName return Mozilla?

查看:22
本文介绍了为什么 navigator.appCodeName 返回 Mozilla?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下 JavaScript 代码在所有浏览器上都返回Mozilla".为什么?

 

解决方案

Short answer: 因为人们认为用户代理检测(而不是 特征(也称为对象)检测)是个好主意,因此浏览器供应商开始撒谎以进行补偿.

长答案:浏览器用户代理字符串的历史

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

 <script type="text/javascript">
 document.write("Browser CodeName: " + navigator.appCodeName);
 </script>

解决方案

Short answer: Because people thought that user agent detection (instead of feature (AKA object) detection) was a good idea, so browser vendors started lying in order to compensate.

Long answer: History of the browser user-agent string

这篇关于为什么 navigator.appCodeName 返回 Mozilla?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆