Frage

I'm hoping to force IE9 into IE8 compatibility mode on just two pages in my site. I'm using the Kentico CMS though, so I don't have an ASPX page that I can go and modify the HEAD tag of. So I was hoping to add the META tag by using a user control or a web part.

In the web part, I tried the following code:

this.Page.Header.Controls.Add(new LiteralControl(mystring));

However, this typically adds the header as the last tag in the HEAD section. IE compatibility mode requires that this be the first tag in the head section.

Is this possible from the code behind?

Or if someone has specialized knowledge of Kentico, a Kentico specific solution would work too.

I only want this to work on two specific pages in my site though. Not all of them!

War es hilfreich?

Lösung

You should add an X-UA-Compatible header to Response.Headers directly rather than using an http-equiv meta.

Andere Tipps

You can use the Head HTML web part and place it on the documents (actually on Design tab to given page template) with the code you need and it will be added to the head tag of those pages.

If the documents are sharing a page template with documents where you do not want to apply this header code, you can use the visibility field and add a macro to return true/false. Below is an example:

{%cmscontext.currentdocument.documentname|(equals)%}

you can also use other properties than document name like document alias, ID, etc.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top