Jan 16, 2012, 1:02 PM
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.
Possible Fix for Ext 1.2.0:
In ResourceManager.cs, add property to control the insertion index for the style sheet.
With the fix implemented, the following page works with with the compatibility tag
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>