Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I force IE users to install Google Chrome Frame Plugin

I am using google visualization for charts, which doesn't render very well in IE8, and doesn't work at all in IE6.

I added google chrome frame, and if the user installs the plug-in google visualization works flawlessly.

Is there a way that I can force IE users to install GFC? Right now it is optional. I read the documentation, and there does not seem to be a way to configure this through the GFCInstall.check() function call.

Here is my current code:

<!--[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]-->
like image 344
Ed Sullivan Avatar asked Dec 16 '22 09:12

Ed Sullivan


1 Answers

It would almost certainly be better to do this via capability-sniffing. Assuming that the feature you need to get nice visualisations is <canvas> support, sniff for that rather than a specific browser:

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.'
    );
}
like image 53
bobince Avatar answered Dec 21 '22 22:12

bobince