javascriptinternet-explorerx-ua-compatible

Does using the x-ua-compatible meta tag affect Javascript performance?


In a situation where the x-ua-compatible meta tag is being used, such as the simple example below...

<html>
    <head>
        <title>A Test Site</title> 
        <meta http-equiv="x-ua-compatible" content="IE=EmulateIE8">
        <script>
        function displayMessage(msg) { 
            alert(msg); 
        }
        </script>
    </head>
    <body onLoad="displayMessage('Hello World!');">
    
    </body>
</html>

...does this affect the Javascript performance of Internet Explorer? As I understand it, the tag affects which of the rendering engines are used to display a page (MSDN reference).

Does using the tag change how Javascript is executed on a page or is this divorced from the rendering engine (so I could display a page to Internet Explorer 8 standards but run the Javascript with the JavaScript engine used in Internet Explorer 11 for example)?


Solution

  • The x-ua-compatible directive does change your JavaScript. There are some things that still exist when you're in a legacy document mode, but by and large, you'll get a JavaScript environment and syntax that looks and feels like it did during the days of the legacy environment.

    I work on the Microsoft Edge team, and am happy to address any specific issues you may have with JavaScript, legacy document modes, and supporting older instances of Internet Explorer.