بوروكراتيك/过时浏览器

检测过时浏览器

安装: 924

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 376

语言:HTML

dev-develop 2020-06-10 07:08 UTC

This package is auto-updated.

Last update: 2024-09-10 15:56:37 UTC


README

开发者节省时间的工具。它可以检测过时浏览器并建议用户升级到新版本。

因此,您可能厌倦了人们使用过时浏览器访问您的现代网站却无所作为。他们可能不是“高级”用户,也许是你那位使用上个世纪浏览器的阿姨,试图查看令人惊叹的CSS3动画和转换。让用户知道这是一个过时的浏览器,并建议他们使用更好的浏览器。

使用此解决方案,您可以检查用户的浏览器是否可以处理您的网站。如果不能,它将显示一个酷炫的 通知,建议用户更新浏览器。升级与否将由用户决定。不要强迫用户!

这就是全部!简单到不能再简单了。

如何使用它

重要:由于旧浏览器(例如IE6、IE7),我们建议

  • 在所有其他javascript(插件或您自己的脚本)之前实现此插件;
  • 尽管我们已经测试了AJAX方法,并且它更容易实现,但我们建议在不使用AJAX调用(5)的情况下使用插件。

考虑到这些点,与您的代码发生冲突的可能性较小。这些浏览器有“奇怪”的js错误,插件可能无法按预期工作。所以保持简单!

  1. 在HTML头部包含CSS

    <link rel="stylesheet" href="your_path/outdatedbrowser/outdatedbrowser.min.css">
  2. 在HTML体底部包含插件脚本

    <script src="your_path/outdatedbrowser/outdatedbrowser.min.js"></script>
  3. 将所需的HTML粘贴到文档末尾(查看演示示例)

    <div id="outdated"></div>
  4. 在HTML体底部放置以下内容以调用插件

    // Plain Javascript
    //event listener: DOM ready
    function addLoadEvent(func) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
                if (oldonload) {
                    oldonload();
                }
                func();
            }
        }
    }
    //call plugin function after DOM ready
    addLoadEvent(function(){
        outdatedBrowser({
            bgColor: '#f25648',
            color: '#ffffff',
            lowerThan: 'transform',
            languagePath: 'your_path/outdatedbrowser/lang/en.html'
        })
    });
    // Using jQuery (version that supports IE < 9)
    $( document ).ready(function() {
        outdatedBrowser({
            bgColor: '#f25648',
            color: '#ffffff',
            lowerThan: 'transform',
            languagePath: 'your_path/outdatedbrowser/lang/en.html'
        })
    })
  5. 不使用AJAX调用使用插件

    <!-- Paste the required HTML at the end of your document (see demo examples) -->
    <div id="outdated">
        <h6>Your browser is out-of-date!</h6>
        <p>Update your browser to view this website correctly. <a id="btnUpdateBrowser" href="https://bestvpn.org/outdatedbrowser/"> Outdated Browser </a></p>
        <p class="last"><a href="#" id="btnCloseUpdateBrowser" title="Close">&times;</a></p>
    </div>
    // Call the plugin (see 4.) but with the variable languagePath empty: 
    // DOM ready or jQuery
    
    outdatedBrowser({
        bgColor: '#f25648',
        color: '#ffffff',
        lowerThan: 'transform',
        languagePath: ''
    })
  6. 针对浏览器

    您可以通过两种方式之一来完成此操作:使用Internet Explorer浏览器作为参考或指定一个CSS属性。结果是一样的,选择您更方便的方法(对于Edge与IE11,请查看问题#198)。

    小于 (<)

    • "IE11","borderImage"
    • "IE10", "transform"(默认属性)
    • "IE9", "boxShadow"
    • "IE8", "borderSpacing"
  7. 选择语言

    下载“lang”文件夹:如果您有您想要的任何语言,只需在项目中写入语言文件的正确路径;如果您没有您想要的语言,您可以编写自己的html文件,并请与我们分享。

这样就完成了!

PS:检查“demo”文件夹,可能会有所帮助。

如何安装

您有几种选择:您可以手动下载存储库,或者可以使用包管理器来为您完成这项工作。

# NPM
$ npm install outdatedbrowser

# Yarn
$ yarn add outdatedbrowser

# Bower
$ bower install outdated-browser

常见问题解答

在打开新问题之前,请检查我们的常见问题解答页面

贡献

  • 将项目进行分支。
  • 阅读问题或报告新问题。
  • 编写一些测试以确保我们不会意外破坏彼此的代码。
  • 发送拉取请求。

注意:请注意,这 NOT 是最新浏览器的插件,而恰恰相反!HTML、CSS和JavaScript必须在非常旧的浏览器(IE6、IE7等)中正常工作,因此没有使用最新建议的必要。它必须在IE6上正常工作,所以在发送拉取请求之前请务必进行双重测试。

翻译 使用正确的语言缩写和 IETF 语言标签重命名:两位数语言代码(ISO 639-1) — 两位数国家代码(ISO 3166-1)。为了简化,我们使用全部 小写,且如果不存在地区变体,可以省略 国家代码。带有语言-国家代码的链接:[ISO 语言代码表](http://www.lingoes.net/en/translator/langcode.htm "ISO 语言代码表"), [Windows 地区代码](http://www.science.co.il/Language/Locale-codes.asp "Windows 地区代码")。

当前可用语言:ar, cs, da, de, el, en, es, es-pe, et, fa, fi, fr, hr, hu, hy, id, it, ja, ko, lt, nb, nl, pl, pt, pt-br, ro, ru, sk, sl, sv, tr, uk, zh-cn, zh-tw

内容管理系统、框架等

— 由 Deblyn Prado 开发的 [Wordpress 插件](https://github.com/deblynprado/wp-outdated-browser "Wordpress 插件") — 由 Luisa Lima 开发的 [Ruby 钩子](https://github.com/luisalima/outdatedbrowser_rails "Ruby 钩子") — [Yii2 小部件](https://yiiframework.cn/extension/yii2-outdated-browser "Yii2 小部件") — 由 Mag. Andreas Mayr 开发的 [Drupal 插件](https://www.drupal.org/sandbox/agoradesign/2369737 "Drupal 插件") — 由 Joey Hoer 开发的 [Magento 扩展](https://github.com/gaugeinteractive/magento-outdated-browser "Magento 扩展") — 由 Lucas Gehin 开发的 [Contao 开源 CMS 模块](https://github.com/lucasgehin/contao-outdatedbrowser "Contao 开源 CMS 模块")

团队

Bürocratik 爱心制作于 2014—2019。
Outdated Browser 于 2019 年 6 月被收购。

许可证

MIT 许可证