{"id":2667,"date":"2009-10-07T07:22:41","date_gmt":"2009-10-07T12:22:41","guid":{"rendered":"http:\/\/bobbeaty.com\/wp\/?p=2667"},"modified":"2009-10-07T07:27:59","modified_gmt":"2009-10-07T12:27:59","slug":"adding-google-chrome-frame-to-pages-for-ie-compatibility","status":"publish","type":"post","link":"https:\/\/bobbeaty.com\/wp\/archives\/2667","title":{"rendered":"Adding Google Chrome Frame to Pages for IE Compatibility"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/bobbeaty.com\/wp\/wp-content\/uploads\/2009\/04\/googlechrome.jpg\" alt=\"GoogleChrome.jpg\" border=\"0\" width=\"125\" height=\"125\" align=\"right\" \/><\/p>\n<p>I've been working on a web app that's a very heavy JavaScript page, and as such, I've had to force users to run it in <a href=\"http:\/\/www.google.com\/chrome\">Google Chrome<\/a> as that's the only browser that has a decent JavaScript Engine (on Windows) that can handle the load. It doesn't hurt that I'm using a lot of the Google AJAX libraries, and so they are sort-of made for each other.<\/p>\n<p>This morning I took a whack at the new <a href=\"http:\/\/code.google.com\/chrome\/chromeframe\/\">Google Chrome Frame<\/a>. This slick IE plug-in is the <em>complete<\/em> <a href=\"http:\/\/www.google.com\/chrome\">Google Chrome<\/a> environment in a plug-in frame for IE. This means that pages that run in <a href=\"http:\/\/www.google.com\/chrome\">Chrome<\/a> will run in the <a href=\"http:\/\/code.google.com\/chrome\/chromeframe\/\">Chrome Frame<\/a> <strong><em>without modification<\/em><\/strong>.<\/p>\n<p>That's <strong>big<\/strong> news. I was stunned.<\/p>\n<p>So I decided to try it out. First, you need to put the <tt>meta<\/tt> tag in your pages to tell IE to use the <a href=\"http:\/\/code.google.com\/chrome\/chromeframe\/\">Chrome Frame<\/a> plugin:<\/p>\n<pre>\n  < meta http-equiv=\"X-UA-Compatible\" content=\"chrome=1\" \/>\n<\/pre>\n<p>That, in itself, will make things work, but if you wanted to <em>verify<\/em> that the plug-in was installed, then you can add the following to your page to do the check and redirect the user to the <a href=\"http:\/\/code.google.com\/chrome\/chromeframe\/\">Google Chrome Frame<\/a> download page if it's not installed. First, you need to load the script in the <tt>head<\/tt> of the page:<\/p>\n<pre class=\"javascript\" style=\"font-family:monospace;\">  <span style=\"color: #339933;\">&lt;<\/span> script type<span style=\"color: #339933;\">=<\/span><span style=\"color: #3366CC;\">&quot;text\/javascript&quot;<\/span>\n  src<span style=\"color: #339933;\">=<\/span><span style=\"color: #3366CC;\">&quot;http:\/\/ajax.googleapis.com\/ajax\/libs\/chrome-frame\/1\/CFInstall.min.js&quot;<\/span> <span style=\"color: #339933;\">&gt;&lt;\/<\/span>script<span style=\"color: #339933;\">&gt;<\/span><\/pre>\n<p>Then in the <tt>body<\/tt> of the page, you need to define a <tt>div<\/tt> that will be the target of the download prompt frame:<\/p>\n<pre>\n  < div id=\"chrome_check\" \/>\n<\/pre>\n<p>just make the <tt>id<\/tt> unique and you'll be fine.<\/p>\n<p>Next, have the JavaScript code in the initialization of your page:<\/p>\n<pre class=\"javascript\" style=\"font-family:monospace;\">  CFInstall.<span style=\"color: #660066;\">check<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#123;<\/span> node<span style=\"color: #339933;\">:<\/span> <span style=\"color: #3366CC;\">&quot;chrome_check&quot;<\/span> <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/pre>\n<p>The <tt>CFInstall.check()<\/tt> function checks to see if <a href=\"http:\/\/code.google.com\/chrome\/chromeframe\/\">Chrome Frame<\/a> is installed, and if not, will display at the <tt>div<\/tt> indicated by the <tt>node<\/tt> property a download page hosted by Google. The user can then download <a href=\"http:\/\/code.google.com\/chrome\/chromeframe\/\">Chrome Frame<\/a> and that's it. It's ready to go.<\/p>\n<p>The docs on <a href=\"http:\/\/code.google.com\/chrome\/chromeframe\/\">Chrome Frame<\/a> say that the page should automatically reload, but I haven't found that to be the case. It could be just me, I've only tried it once, but even that isn't bad. It's something that allows users to send links in emails and have their default browser (IE) render the project's pages in a <a href=\"http:\/\/www.google.com\/chrome\">Chrome<\/a> environment.<\/p>\n<p>Super sweet.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been working on a web app that&#8217;s a very heavy JavaScript page, and as such, I&#8217;ve had to force users to run it in Google Chrome as that&#8217;s the only browser that has a decent JavaScript Engine (on Windows) that can handle the load. It doesn&#8217;t hurt that I&#8217;m using a lot of the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[],"class_list":["post-2667","post","type-post","status-publish","format-standard","hentry","category-coding","category-cube-life"],"_links":{"self":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts\/2667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/comments?post=2667"}],"version-history":[{"count":8,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts\/2667\/revisions"}],"predecessor-version":[{"id":2675,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts\/2667\/revisions\/2675"}],"wp:attachment":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/media?parent=2667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/categories?post=2667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/tags?post=2667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}