Change X-UA-Compatible from <meta> tag to HTTP header
authorMatthew Flaschen <mflaschen@wikimedia.org>
Mon, 21 Apr 2014 22:46:56 +0000 (18:46 -0400)
committerMattflaschen <mflaschen@wikimedia.org>
Wed, 30 Apr 2014 03:44:04 +0000 (03:44 +0000)
Derk-Jan Hartman suggested this to remove a HTML validation error.  As he
noted, the HTTP header is also more effective, since it works on
intranets, and is not sensitive to ordering issues within the <head>.

See http://stackoverflow.com/questions/6156639 .

Bug: 62885
Change-Id: I2214abcb1badbbaca48427a31d1218c9db9a6af7

includes/OutputPage.php

index f5dbfc6..76f0aab 100644 (file)
@@ -2039,6 +2039,10 @@ class OutputPage extends ContextSource {
                $response->header( "Content-type: $wgMimeType; charset=UTF-8" );
                $response->header( 'Content-language: ' . $wgLanguageCode );
 
+               // Avoid Internet Explorer "compatibility view" in IE 8-10, so that
+               // jQuery etc. can work correctly.
+               $response->header( 'X-UA-Compatible: IE=Edge' );
+
                // Prevent framing, if requested
                $frameOptions = $this->getFrameOptions();
                if ( $frameOptions ) {
@@ -2523,10 +2527,6 @@ $templates
 
                $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
 
-               // Avoid Internet Explorer "compatibility view", so that
-               // jQuery can work correctly.
-               $ret .= Html::element( 'meta', array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EDGE' ) ) . "\n";
-
                $ret .= (
                        $this->getHeadLinks() .
                        "\n" .