I have a JSP page in a JSF application which uses A4J. I want to add a meta tag to put IE9 in compatibility mode. Unfortunately, this meta tag has to be the first tag in the head.
A4J automatically adds some tags to the head to load its stylesheets and javascript. This gets added before the IE9 meta tag.
I’ve searched the documentation for A4J, but couldn’t find anything about how to control these tags.
Does anybody know how i can insert the IE9 meta tag before the A4J tags?
Here is the first part of my JSP page:
<?xml version="1.0" encoding="utf-8"?>
<html xml:lang="nl" xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tsi="http://components.traserv.com/jsf"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:t="http://myfaces.apache.org/tomahawk">
<jsp:output doctype-public="-//W3C//DTD XHTML 1.1//EN"
doctype-root-element="html"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
omit-xml-declaration="false" />
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
...
And here is the output:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl">
<head>
<link class="component" href="/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.f" rel="stylesheet" type="text/css" />
<link class="component" href="/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.f" media="rich-extended-skinning" rel="stylesheet" type="text/css" />
<script src="/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.AjaxScript.f" type="text/javascript"></script>
<script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>
<script src="/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/skinning.js.f" type="text/javascript"></script>
<meta content="IE=EmulateIE8" http-equiv="X-UA-Compatible"/>
<title></title>
....
You could set X-UA-Compatible as an HTTP header instead of including it in the page as a meta tag. This works just as well, better in fact, in IE.
How you do this in a JSF set up I’m afraid I don’t know.