4

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]-->
Ed Sullivan
  • 728
  • 1
  • 9
  • 23
  • 5
    you can't force a user to install anything. it would be illegal – Vlad Balmos Sep 23 '11 at 14:38
  • 2
    On a somewhat tangential note - If you, as a user, are installing compatibility layers on top of your outdated browser, why not just update your browser? – Andreas Eriksson Sep 23 '11 at 14:38
  • I know I can't force them to install it, but I can not let them use the site if they don't... – Ed Sullivan Sep 23 '11 at 14:39
  • I would prefer the user to upgrade there browser, but that is a much harder war to fight – Ed Sullivan Sep 23 '11 at 14:40
  • you can ask them to install it, but you can't force them to. – Spudley Sep 23 '11 at 14:41
  • 1
    @AndreasCarlbom The one instance I can think of it being in a corporation that doesn't allow alternative browsers. Chrome Frame can be installed without Admin privs because it doesn't touch system/program files. – JaredMcAteer Sep 23 '11 at 14:41
  • They best solution I can think of is masking the whole background as black if IE user and GFC isn't installed. Was looking for something less hacky if possible. – Ed Sullivan Sep 23 '11 at 14:52
  • Couldn't you just redirect them, instead? To the GFC installation page, perhaps? – Andreas Eriksson Sep 23 '11 at 14:56
  • @AndreasCarlbom I could do that, but then there would not be an automatic redirect back to my site after installation – Ed Sullivan Sep 23 '11 at 14:58
  • Yeah but you could like make a page on your site, wherein you ask your visitors to install it, and provide them with a link. And redirect to that. – Andreas Eriksson Sep 26 '11 at 06:31
  • As per The Chromium Blog, Google Chrome Frame will be **retired in January 2014**. More information on this blog post: http://blog.chromium.org/2013/06/retiring-chrome-frame.html – Kurt Oct 14 '13 at 10:55

2 Answers2

7

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.'
    );
}
bobince
  • 528,062
  • 107
  • 651
  • 834
  • The conditional it is referring to is – Ed Sullivan Sep 23 '11 at 17:12
  • The OP wants to install an IE-specific plugin to work around IE-specific limitations. I don't think capability-sniffing really addresses that. – jalf Feb 12 '13 at 14:57
  • @jalf: It's not an IE-specific limitation. The visualisation will fail on any browser X that does not support the relevant graphics feature (either Canvas or SVG, depending on what the implementation is). The solution is to switch to browser Y that supports it. Limiting the question to [X=IE8, Y=ChromeFrame] is unnecessary and undesirable. – bobince Feb 12 '13 at 17:20
5

No you cannot force the user - your best options from the Google Chrome Frame FAQ:

How do I tell if a user has Google Chrome Frame installed?

Google Chrome Frame adds a ‘chromeframe/X.X.X.X’ token to the User-Agent header so you can check for its presence that way. If Google Chrome Frame isn’t present, you can choose to either prompt or show fallback content. See http://www.chromium.org/developers/how-tos/chrome-frame-getting-started/understanding-chrome-frame-user-agent for more information on the User-Agent header.

We've also provided a JavaScript library you can use to test whether Google Chrome Frame is installed and if not, to prompt the user to install it. See http://www.chromium.org/developers/how-tos/chrome-frame-getting-started for more details on how to use and customize the JavaScript library.

Community
  • 1
  • 1
Barry Kaye
  • 7,682
  • 6
  • 42
  • 64
  • Can I configure chrome frame install menu to always appear on top of my login panel if it is not installed. Right now the menu allows the user to decline the installation. If they decline the installation I don't want them to be able to login to my application. – Ed Sullivan Sep 23 '11 at 14:57
  • 1
    You could always inspect the User-Agent header and if `chromeframe/X.X.X.X` is not present hide your login panel and display a 'this works best with Chrome frame' message instead. – Barry Kaye Sep 23 '11 at 15:15