Skip to content

Commit 123eb25

Browse files
committed
Add a header that tells Internet Explorer (all versions) to use the best available standards support. This ensures that IE doesn't go into quirks mode because it has been blacklisted by too many users pressing the incompatible button. It also tells IE to use the ChromeFrame renderer, if the user has installed the plugin.
This guarantees that the best available standards support will be used on the client.
1 parent e17e08e commit 123eb25

File tree

6 files changed

+7
-3
lines changed

6 files changed

+7
-3
lines changed

actionpack/lib/action_dispatch.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module ActionDispatch
4747
end
4848

4949
autoload_under 'middleware' do
50+
autoload :BestStandardsSupport
5051
autoload :Callbacks
5152
autoload :Cookies
5253
autoload :Flash

actionpack/lib/action_dispatch/railtie.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ class Railtie < Rails::Railtie
77
config.action_dispatch.x_sendfile_header = ""
88
config.action_dispatch.ip_spoofing_check = true
99
config.action_dispatch.show_exceptions = true
10+
config.action_dispatch.best_standards_support = true
1011

1112
# Prepare dispatcher callbacks and run 'prepare' callbacks
1213
initializer "action_dispatch.prepare_dispatcher" do |app|
1314
ActionDispatch::Callbacks.to_prepare { app.routes_reloader.execute_if_updated }
1415
end
1516
end
16-
end
17+
end

railties/lib/rails/application.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def default_middleware_stack
205205
middleware.use ::ActionDispatch::ParamsParser
206206
middleware.use ::Rack::MethodOverride
207207
middleware.use ::ActionDispatch::Head
208+
middleware.use ::ActionDispatch::BestStandardsSupport if config.action_dispatch.best_standards_support
208209
end
209210
end
210211

railties/lib/rails/commands.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@
7070
7171
All commands can be run with -h for more information.
7272
EOT
73-
end
73+
end

railties/lib/rails/engine/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ def autoload_paths
5050
end
5151
end
5252
end
53-
end
53+
end

railties/test/application/routing_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def index
4040

4141
get '/foo'
4242
assert_equal 'foo', last_response.body
43+
assert_equal "IE=Edge,chrome=1", last_response.headers["X-UA-Compatible"]
4344
end
4445

4546
test "simple controller with helper" do

0 commit comments

Comments
 (0)