myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoersch, Dennis" <Hoer...@his.de>
Subject AW: Content in facet metaContainer is not the first in <head>
Date Thu, 29 Mar 2012 17:05:47 GMT
Hi,

we had a similar problem (without the facet). The only way we found was to 'hack' the class
'org.apache.myfaces.renderkit.html.util.DefaultAddResource' such that if it founds the compatibility-mode-tag
it moves to the first position... but maybe (sure ;-)) there is a better solution.

greetings,
dennis hoersch



---
HIS Hochschul-Informations-System GmbH
Goseriede 9 | 30159 Hannover | www.his.de

Dennis Hörsch
Unternehmensbereich Hochschul-IT
Arbeitsbereich Entwicklung
Telefon +49 (0)511 1220-403 | Fax +49 (0)511 1220-250
E-Mail hoersch@his.de

Registergericht: Amtsgericht Hannover, HRB 6489
Geschäftsführer: Prof. Dr. Martin Leitner
Vorsitzender des Aufsichtsrats: Prof. Dr. Rolf-Dieter Postlep
________________________________________
Von: Tobias Eisentrager [teisentraeger@googlemail.com]
Gesendet: Donnerstag, 29. März 2012 10:34
An: MyFaces Discussion
Betreff: Content in facet metaContainer is not the first in <head>

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

Mime
View raw message