How can I let a user cancel Chrome Frame installation when prompted

292 views Asked by At

I'm using the default CFInstall script from Google (with a few minor changes):

<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>

This prompts an IE8 or less user to install Chrome Frame. But the user cannot cancel or close the iFrame. How can I achieve this.

1

There are 1 answers

0
Esger On

OK, I got it: I need to set mode to "overlay": This has one drawback: the dialog won't reappear after refreshing the page.

<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>