我正在使用 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/