Internet Explorer pain – How to bypass forced compatibility mode on your intranet?

Internet Explorer pain – How to bypass forced compatibility mode on your intranet?

You use Firefox or Chrome as your primary testing tool for your intranet applications, aren’t you? (If you aren’t, consider doing so: Firefox + Firebug = a powerful web developer tool)

You ignore the fact that the company you’re working for wants Internet Explorer as the default browser. And because there are so many clients and configurations (Windows XP + IE7?) scattered all over the buildings and/or some applications were developed in the middle ages of the (not-so) worldwibe web (yet), your IT-department tends to follow a conservative approach…

compatibilitymode“Great, we can enforce compatibility mode for all users, with the power of a single setting! Feel the power of the Almighty Administrator!” What does this function do exactly? For years developers were begging Microsoft to implement some general css3 features and follow web standards (and it has worked for the latest incarnations of Internet Explorer), then suddenly your browser is thrown back in time, Before It All Really Started To Change. Moreover, the option to change this setting when I want it (for personal use) is grayed out.

What does this mean for the poor developer? Your carefully crafted XPage suddenly looks like you’re doing your first steps on the web. It’s even worse when you want to explore the edges of XPages, f.e. if you’re trying to bootstrap your XPages. Great looks in Firefox, ugly pages and broken layouts in Internet Explorer. It’s like meeting a girl in the evening, having a great night out with her, and see her in hard light in the morning, just to realise there isn’t much left of the magic you saw the evening before :-).

“Oh great IT-God!”, you cry, “Please open the Gates of Progression, at least for my application!” (I don’t care about the others who enjoy staying in the past) “Computer says no,” God answers. It’s only possible to change a general setting on domain level :-(. If you need compatibility mode for a single application in the company, then they enforce it for all applications and for the whole company.

Fortunately, there’s a meta-tag you can add in the head section of your page to override compatibility mode:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

“Grrreat!”, you shout. “… and eh, where do I add this in my XPage? I can add meta name-value pairs, but no such thing as http-equiv?”

After reading an inspirational blog from Michael Gollmick, I learned you can add some SSJS to beforeRenderResponse event of an XPage to get the line above added to the html head:

facesContext.getExternalContext().getResponse().setHeader("X-UA-Compatible", "IE=edge,chrome=1");

If you have a custom control with your layout, you can even add it to the beforeRenderResponse of that CC, so that you only have to add it once in your application!

This single line of code changes this:


to this:

ie9I’m a happy man :-).


    • Hi Thimo,
      Thanks for pointing me to that article. In my particular case, it works out quite nice. A pitty it didn’t for you… I suppose you can take it to the next level now: use some violence to force IT-admin to give up compatibility mode overthere ;-).

    • Marky, thanks, it’s even simpler with the snippet! What’s the point of your point about Thimo’s point about Paul’s point? ;-)

      • The fix may beat compatibility mode but it still sets compatibility mode at the level you want, not the real mode – and while that is close to the real thing, it can be problematic :)

  1. Hi Martin ! Great post. I just testet using IE9 on my company intranet. My company domainname has been put in the list of compability view sites. Pushed out using policy settings.. When I put your line of code in the beforeRenderResponse event of an xpage, the Document mode changes from IE7 to IE9 Standards. That’s good. But, the Browser mode is still IE9 Compat View.. Unchanged.. I really did hope there was a way to override the domain settings, but it doesn’t seem so..


Submit a Comment

Your email address will not be published. Required fields are marked *

Warning: Use of undefined constant AUTH_KEY - assumed 'AUTH_KEY' (this will throw an Error in a future version of PHP) in /customers/2/8/1/ on line 713 − 3 = 4

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>