Java Mailing List Archive

http://www.junlu.com/

Home » users.myfaces »

Content in facet metaContainer is not the first in <head>

Tobias Eisentrager

2012-03-29

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello List,

I am trying to force a document mode in Internet Explorer. Following
the documentation on msdn [1] I have to add the X-UA-compatible header
in the Web page's header (the HEAD section) before all other elements,
except for the TITLE element and other META elements.

I used a <tr:document> with the facet metaContainer but the resulting
page also contains other elements before the content of the facet.

Example:

<?xml version="1.0" encoding="utf-8"?>
<tr:document xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:tr="http://myfaces.apache.org/trinidad"
    xmlns:t="http://myfaces.apache.org/tomahawk"
    xmlns="http://www.w3.org/1999/xhtml"
    title="#{pageTitle}"
    styleClass="start"
    >
    <f:facet name="metaContainer">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
        <meta http-equiv="Content-Language" content="de" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" charset="UTF-8" type="text/css"
media="print" href="style.css" />
   </f:facet>
   <!-- content -->
</tr:document>

Resulting Source:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"><html dir="ltr"
lang="de"><head>
<title>Title of Page</title>
    <meta name="generator" content="Apache MyFaces Trinidad">
    <link rel="stylesheet" charset="UTF-8" type="text/css"
href="/InDocFlowN/adf/styles/cache/ar-desktop-ppd893-ltr-ie.css">
        <meta http-equiv="X-UA-Compatible" content="IE=8">
        <meta http-equiv="Content-Language" content="de">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
        <link rel="stylesheet" charset="UTF-8" type="text/css"
media="print" href="style.css" />
</head>

<!-- content ->
</html>

The problem are these two lines:
<meta name="generator" content="Apache MyFaces Trinidad">
<link rel="stylesheet" charset="UTF-8" type="text/css"
href="/InDocFlowN/adf/styles/cache/ar-desktop-ppd893-ltr-ie.css">

They should not be rendered before the <meta
http-equiv="X-UA-Compatible" content="IE=8"> Otherwise IE will not
honor the tag.
How can I remove / move these two lines or otherwise how can i insert
the compatibility line as the first child of the head.

JSF: Myfaces 1.2.8
Trinidad: 1.2.13
Webserver: IBM WebSphere 6.1

Thanks so much,

Toby

Links:
[1] http://msdn.microsoft.com/library/cc817574.aspx - Section
Specifying Compatibility Modes on a Per-Page Basis
©2008 junlu.com - Jax Systems, LLC, U.S.A.