如何在出现提示时让用户取消Chrome Frame安装

时间:2012-06-05 12:01:56

标签: internet-explorer google-chrome-frame

我正在使用Google的默认CFInstall脚本(稍作修改):

    

<style>
 .chromeFrameInstallDefaultStyle {
   width: 80%; /* default is 800px */
   border: 5px solid blue;
   position: absolute;
   left: 40%;
   z-index: 1000;
 }
</style>

<div id="prompt">
 <!-- if IE without GCF, prompt goes here -->
</div>

<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", // the default
     node: "prompt"
   });
 });
</script>

这会提示IE8或更少用户安装Chrome Frame。但是用户无法取消或关闭iFrame。 我怎样才能做到这一点。

1 个答案:

答案 0 :(得分:0)

好的,我明白了:我需要将模式设置为“叠加”: 这有一个缺点:刷新页面后对话框不会重新出现。

    

<style>
 .chromeFrameInstallDefaultStyle {
   width: 80%; /* default is 800px */
   border: 5px solid blue;
   position: absolute;
   left: 40%;
   z-index: 1000;
 }
</style>

<div id="prompt">
 <!-- if IE without GCF, prompt goes here -->
</div>

<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: "overlay", // "inline" = the default
     node: "prompt"
   });
 });
</script>