IE document compatibility meta tag issue

  1. #1

    IE document compatibility meta tag issue

    To use IE document compatibility meta tags, the tag must be the 1st element in the head section, else it will not take effect. The title tag seems to be an exception to that rule.

    When the head tag has runat="server", the Ext.Net resource manager inserts the style sheet resource as the first element in head section. This behavior prevents compatibility tags from working and displays an error/warning message in the IE browser console on IE 9.

    HTML1115: X-UA-Compatible META tag ('IE=8') ignored because document mode is already finalized.
    TestPage.aspx

    To reproduce, run the following page in IE 9, hit F12, view the console tab.

    
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage.aspx.cs" Inherits="WebApplication1.TestPage" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
      
      <meta http-equiv="X-UA-Compatible" content="IE=8" >
      <title>My webpage</title>
    
    </head>
    <body>
        <form id="form1" runat="server">
    
            <ext:ResourceManager ID="ResourceManager1" runat="server">          
            </ext:ResourceManager>
            
        </form>
    </body>
    </html>

    Possible Fix for Ext 1.2.0:

    In ResourceManager.cs, add property to control the insertion index for the style sheet.

            private int styleResourceIndex = 0;
            public virtual int StyleResourceIndex
            {
                get
                {
                    return styleResourceIndex;
                }
                set
                {
                    this.styleResourceIndex = value;
                }
    
            }
      protected virtual void Page_PreRenderComplete(object sender, EventArgs e)
            {
                if (!this.DesignMode && this.Page != null)
                {
                    if ((!this.IsInHead && (this.StyleContainer == null)) && this.IsNeedRender && !this.IsDynamic)
                    {
                        if (this.Page.Header != null)
                        {                       
    /* Update to use StyleResourceIndex property                        
    this.Page.Header.Controls.AddAt(this.StyleResourceIndex, new ResourcePlaceHolder(ResourceMode.Style));
    */
                        }
                        else if (this.ResourcePlaceHolder != null)
                        {
                            this.ResourcePlaceHolder.Parent.Controls.AddAt(this.ResourcePlaceHolder.Parent.Controls.IndexOf(this.ResourcePlaceHolder), new ResourcePlaceHolder(ResourceMode.Style));
                        }
                        else
                        {
                            this.Page.Controls.AddAt(this.Page.Controls.Count > 0 ? this.Page.Controls.Count-1 : 0, new ResourcePlaceHolder(ResourceMode.Style));
                        }
                    }........

    With the fix implemented, the following page works with with the compatibility tag

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage.aspx.cs" Inherits="WebApplication1.TestPage" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
      
      <meta http-equiv="X-UA-Compatible" content="IE=8" >
      <title>My webpage</title>
    
       <script runat="server">
          protected virtual void Page_Init(object sender, EventArgs e)
          {
              ResourceManager1.StyleResourceIndex = 2;
          }
      </script>
    
    
    </head>
    <body>
        <form id="form1" runat="server">
    
            <ext:ResourceManager ID="ResourceManager1" runat="server">          
            </ext:ResourceManager>
            
        </form>
    </body>
    </html>
  2. #2
    Hi,

    Quote Originally Posted by zach View Post
    To reproduce, run the following page in IE 9, hit F12, view the console tab.
    I followed the steps, but can't see anything wrong, the console is clear on my side.

    You can use the ResourcePlaceHolder control to change the sequence.

    Example
    <head runat="server">
      <meta http-equiv="X-UA-Compatible" content="IE=8" >
      <title>My webpage</title>
      <ext:ResourcePlaceHolder runat="server" Mode="Style" />
    </head>
    We would not consider it a bug:

    1. There is a solution with ResourcePlaceHolder.
    2. Generally, IE compatibility modes are not officially supported.

Similar Threads

  1. [CLOSED] Compatibility with chrome and firefox issue
    By imaa in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Dec 20, 2011, 10:42 PM
  2. [0.8.2 ] compatibility issue with ie6.0
    By pierluigiM in forum 1.x Help
    Replies: 2
    Last Post: Nov 29, 2010, 1:41 PM
  3. Compatibility view issue in IE 8 and Mozilla
    By Nagaraj K Hebbar in forum 1.x Help
    Replies: 12
    Last Post: Jan 14, 2010, 11:36 PM
  4. [CLOSED] Browser compatibility issue with Layout
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 14, 2009, 9:24 AM
  5. [CLOSED] Browser compatibility issue with Layout
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 25, 2009, 11:43 AM

Posting Permissions