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…
“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:
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: