Search code examples
ajaxinternet-explorer-9prototypejs

some IE9 turn into Compatibility View on Ajax request


I have a web application that uses ajax with prototype.js (Ajax.Updater).

new Ajax.Updater('someID','/some/url',
    {
        asynchronous:true,
        evalScripts:true,
        parameters:Form.serialize(Event.element(event).form),
        requestHeaders:['X-Update', 'someID']
    }
);

Some (not all) IE9 users experience a strange phenomenon.

  • UserAgent of normal (non-ajax) HTTP requests indicates that the browser is IE9, not in Compatibility View.
  • UserAgent of ajax HTTP requests indicates that the browser is IE7 (IE9's Compatibility View).

I want to force the browser not to use Compatibility View in ajax HTTP requests, but the html already has a meta tag : <meta http-equiv="X-UA-Compatible" content="IE=edge">.

Does anyone know the reason or workaround?


Solution

  • This is a possible solution - but not fully researched - try setting

    Header set X-UA-Compatible "IE=edge"
    

    in your httpd.conf or .htaccess file - this will add the X-UA-Compatible header to all responses from Apache to force IE not to use Compatibility Mode