Question

My dotnetnuke website looks fine in IE9 but breaks in IE8 & IE7.

I've tried the meta tag :

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

but if i put it in the ascx ( 1st line ) but it doesnt show up. And if i put it in the page setting - tags , it shows up at the bottom of the header. So it also doesnt work that way, how to get the tag on top or is there any other way?

Thanks in advance.

Was it helpful?

Solution

You can use some code to add the directive. In your skin (or, in a control that is references by each skin control), add the following:

<script runat="server">
    private void Page_PreRender(object sender, EventArgs e)
    {
        var meta = new HtmlMeta();
        meta.Content = "IE=edge";
        meta.HttpEquiv = "X-UA-Compatible";
        this.Page.Header.Controls.AddAt(0, meta);
    }
</script>

This requires that AutoEventWireup is true in the Control directive. Otherwise you'll also need to override OnInit or something like it to manually wire up the event.

OTHER TIPS

I hate to suggest this, but you might need to add this to default.aspx in the root of your website, if you do this though, you'll need to remember to do it again when you upgrade DNN in the future.

I haven't seen this done before, but this is how it was done for emulating IE 8/7 when using IE 9:

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

If not, then try this one:

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

Add those to your header with the other meta tags. This should force IE10 to render as IE9.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top