为什么我不能使用 JQuery 2 显示浏览器版本?

Why I can't show the browser version using JQuery 2?

我是 JavaScript 和 JQuery 的新手,我遇到了以下问题。

我已经包含 JQuery 2.1.4 并且我正在尝试实现一个非常简单的 JQuery 脚本来显示浏览器名称及其版本。

所以我正在尝试遵循这个官方文档"tutorial":http://api.jquery.com/jquery.browser/

所以,在我的页面中,我做了这样的事情:

<script>

    $(document).ready(function() {
        alert($.browser.version);
    });

</script>

但它不起作用,事实上弹出窗口未显示并进入 FireBug 控制台,我收到以下错误消息:

TypeError: $.browser is undefined
    alert($.browser.version);

为什么?我错过了什么?我该如何解决这个问题?

$.browser 的功能已从 jQuery v 1.3 中弃用并从 jQuery 1.9 中删除,因此您不能在 jQuery 中使用它] 版本 2.

来自Docs

Description: Contains flags for the useragent, read from navigator.userAgent. This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. Please try to use feature detection instead.