I have spent the majority of my development time over the past few years trying to get IE to play nice with cool things we’re trying to do on the CMS. Not a fun task.

One issue I came across recently pertained to the auto-expand call for iframes on an IE9 page. When you would hover anywhere it would start to resize the iframe automatically. So wonky. And yes, that’s a technical term.

Looked around and found this to be a good working solution when it comes to 1) detecting IE and 2) rendering a different value accordingly.


<!– Use the following code to detect whether the browser is IE –>
<g:evaluate var="jvar_is_ie">
try {
var isMSIE = Packages.com.glide.sys.Transaction.get().getRequest().getHeader('user-agent').indexOf("MSIE") > 0 ? true : false;
} catch (e) {
isMSIE = false;
}
isMSIE;
</g:evaluate>
<!– If the browser is IE, set the height & width as a fixed value. If not, set it to just 'expand' –>
<j:switch on="${jvar_is_ie}">
<j:case value="true">
gr.sizing = '';
gr.height = '800px';
gr.width = '1100px';
</j:case>
<j:default>
gr.sizing = 'expand';
</j:default>
</j:switch>

Author

With over a decade of experience, I have managed online marketing for a wide range of industries including biotech, high-tech, financial, higher education, non-profit, manufacturing, hardware providers, and startups. My specialty is helping business make the right turn with their online efforts focusing on lead generation and analytics.

Leave a Reply