CARVIEW |
Every repository with this icon (

Every repository with this icon (

Fork of sunlightlabs/rack-chromeframe | |
Description: | Rack middleware to implement Google Chrome Frame edit |
Homepage: | edit |
Public Clone URL: |
git://github.com/Stanley/rack-chromeframe.git
Give this clone URL to anyone.
git clone git://github.com/Stanley/rack-chromeframe.git
|
Your Clone URL: |
Use this clone URL yourself.
git clone git@github.com:Stanley/rack-chromeframe.git
|
tree 68feebe1d97b23f29595b5fdb742a1bca1100752
parent 1799113e9d8a5aa0ec9c9fb3dbd8eeb8811307e3
name | age | message | |
---|---|---|---|
![]() |
.gitignore | Wed Sep 23 07:40:37 -0700 2009 | Initial commit [luigi] |
![]() |
LICENSE.md | Wed Sep 23 07:40:37 -0700 2009 | Initial commit [luigi] |
![]() |
README.md | Thu Oct 01 06:23:00 -0700 2009 | updated README [Stanley] |
![]() |
lib/ | Thu Oct 01 05:29:16 -0700 2009 | now works with merb and returns new page when c... [Stanley] |
![]() |
spec/ | Thu Oct 01 05:25:33 -0700 2009 | replaced test/unit with my new rspec tests [Stanley] |
Rack Middleware for Google Chrome Frame
Written by Luigi Montanez of the Sunlight Labs, a group of civic hackers. Updated by Stanley. Copyright 2009.
Google Chrome Frame is an open source plug-in that brings HTML5 and other open web technologies to Internet Explorer. See the developer's guide for more on implementation.
This middleware injects snippets of code into every outgoing HTML response, which only affects Internet Explorer users.
At the beginning of the <head>
, enable Chrome Frame if it's installed:
<meta http-equiv="X-UA-Compatible" content="chrome=1">
Rendres new page to prompt the user to install Chrome Frame (only when it's not yet installed) with following body section:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<div id="cf-placeholder"></div>
<script>CFInstall.check({node: "cf-placeholder"});</script>
The user will be presented with a blank page displaying the official Chrome Frame installation page.
Configuration
To use in your Rails app, place lib/rack/chrome_frame.rb
in lib/rack
.
Then in environment.rb
:
config.middleware.use "Rack::ChromeFrame"
Or in the config.ru
(config/rack.rb
) rackup file of your Sinatra (Merb) app:
require 'chrome_frame'
use Rack::ChromeFrame
That's all there is to it. Fire up your app, View Source on any page, and see the magic.
Options
You can customize middleware behavior by passing some optional parameters:
use Rack::ChromeFrame, {:minimum => 8.0} will prompt only users with older IE version than 8.0
use Rack::ChromeFrame, {:destination => "https://www.github.com"} will pass this option to CFInstall.check() JS method
Tests
To run the tests:
cd spec
spec chrome_frame_spec.rb