javascript - 我可以强制 IE 用户安装 Google Chrome Frame 插件吗?

标签 javascript internet-explorer google-chrome-frame

我正在使用 google 可视化图表,它在 IE8 中呈现效果不是很好,在 IE6 中根本不起作用。

我添加了 google chrome frame,如果用户安装了插件,google visualization 会完美运行。

有没有办法强制 IE 用户安装 GFC?现在它是可选的。我阅读了文档,似乎没有办法通过 GFCInstall.check() 函数调用来配置它。

这是我当前的代码:

<!--[if IE]>
    <script type="text/javascript" 
     src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>

    <style>
     .chromeFrameInstallDefaultStyle {
       border: 5px solid blue;
        top:55%;
     }
    </style>



    <script>
     // The conditional ensures that this code will only execute in IE,
     // Therefore we can use the IE-specific attachEvent without worry
     window.attachEvent("onload", function() {
       CFInstall.check({
         mode: "inline" 
       });
     });
    </script>
  <![endif]-->

最佳答案

通过能力嗅探几乎可以肯定会更好。假设您需要获得漂亮的可视化效果的功能是 <canvas>支持,嗅探那个而不是特定的浏览器:

if (!('width' in document.createElement('canvas'))) {
    document.write(
        'The visualisations on this page don\'t work well in your current browser. '+
        'Please upgrade to a modern browser such as IE9, Firefox, Opera, Safari or '+
        'Chrome, or install Chrome Frame for earlier IE versions.'
    );
}

关于javascript - 我可以强制 IE 用户安装 Google Chrome Frame 插件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7530687/

相关文章:

javascript - 契约:在最终确定之前或之后向经纪人发布契约

internet-explorer - 是否有针对 Internet Explorer 的自定义元素 polyfill?

javascript - 图像不会在 IE 中加载

html - 如何让使用(进度)栏在IE中​​正确显示

google-chrome-frame - 如何在 IE 的谷歌浏览器框架插件中启用文件协议(protocol)

c# - 如何在没有管理员权限的情况下安装 chrome-frame?

javascript - Google Chrome 框架叠加层仅有效一次

javascript - 即使在将数字显式转换为字符串变量后,Angular 仍然编译没有错误

javascript - 单个 Javascript 对象属性的多个值

javascript - promise hell 、反模式和错误处理