Avoid IE Compatibility View for Intranet Sites

Avoid IE Compatibility View for Intranet Sites

by Jonathan Langton -
Number of replies: 6

Following on from this thread https://moodle.org/mod/forum/discuss.php?d=231970&parent=1065226 and the fact that IE defaults to Compatibity View for Intranet sites, may it not be worth considering including in vanilla Moodle a way to avoid this?

Compatibility View is basically IE7.  Unfortunately we still have to consider IE and for internal Moodles it will default to Compatibility View, which is going to detract from the appearance and performance of the platform without some kind of intervention in each installation of the browser.

I'm not a programmer, but perhaps something could be added to the HTML header, or something similar, to trick IE into not reverting to Compatibility View?

Cheers

Jonathan

Average of ratings: Useful (1)
In reply to Jonathan Langton

Re: Avoid IE Compatibility View for Intranet Sites

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

We added this to our theme to solve the issue:

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

It has to be at the start of the <head> block or won't work. I assume somebody could make this change to all the core themes if desired... or perhaps it would be better to change the actual headers sent to include this one? I think there's maybe a single point of code where Moodle sets a bunch of headers about not caching and stuff, so it could go there and fix the whole problem at once?

--sam

Average of ratings: Useful (1)
In reply to sam marshall

Re: Avoid IE Compatibility View for Intranet Sites

by Franc Pombal -

Hello

Very good tip!

The file "moodle\lib\outputrenderers.php  #public function standard_head_html ()" load the standard META TAG's in moodle. You could modify directly there, but that would increase the work on upgrades.

I designed the theme "aigne" (available at plugins) where I extended that function. With your permission Sam, and to increase compatibility, I'll add that META TAG to the theme options.

Greetings...

In reply to sam marshall

Re: Avoid IE Compatibility View for Intranet Sites

by David Scotson -
I thought Moodle already did this via headers?

It was discussed when we started using HTML5 doctype here:
https://tracker.moodle.org/browse/MDL-34299?focusedCommentId=170566&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-170566

And Petr replied that this was already done (presumably via headers).

Checking the headers of qa.moodle.net I can see:

x-ua-compatible: "IE=edge"

So is it a case of this not working in certain situations?
In reply to David Scotson

Re: Avoid IE Compatibility View for Intranet Sites

by Dan Poltawski -

So is it a case of this not working in certain situations?

I guess the original poster is using Moodle < 2.4 when this wasn't the case.

In reply to Dan Poltawski

Re: Avoid IE Compatibility View for Intranet Sites

by David Scotson -
In the other thread they say they're running Moodle 2.5.1, and I checked our 2.4 install and I see the correct header there, so maybe there's some other variable?

Looking at the code, it seems to scan through any HTML you've added to the HEAD section via settings in order to not overule any attempt to change this setting via meta tags, maybe that's the cause here?

https://github.com/moodle/moodle/blob/master/lib/weblib.php#L2031
In reply to David Scotson

Re: Avoid IE Compatibility View for Intranet Sites

by Jonathan Langton -

Quite right, David.  We are using 2.5.1.  I am particularly aware of this issue while using the Essential theme, which has some elements that don't work in IE7 and which returns an error message at the top of the screen.