简体   繁体   English

IE9渲染IE8文档标准

[英]IE9 rendering IE8 document standard

I need my application to run in IE9 document standard and I cannot figure out why it automatically renders in IE8 document standard. 我需要我的应用程序在IE9文档标准中运行,我无法弄清楚为什么它会在IE8文档标准中自动呈现。

I'm using JSF 2.1.17 and Primefaces 3.4, running in Glassfish 3.1.2. 我正在使用在Glassfish 3.1.2中运行的JSF 2.1.17和Primefaces 3.4。 My IDE is Netbeans-7.1.2. 我的IDE是Netbeans-7.1.2。 When I open the developer tools in IE, under the "HTML" tab it shows: 当我在IE中打开开发人员工具时,在“HTML”选项卡下显示:

<--!DOCTYPE html-->
<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 

However, under the "Script" tab it shows: 但是,在“脚本”选项卡下,它显示:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML lang=en xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<HEAD>
<META content="IE=8.0000" http-equiv="X-UA-Compatible">

I have looked through all my pages and templates and NO WHERE can I find the meta content="IE=8.0000" or the !DOCTYPE that is shown above . 我查看了所有的页面和模板,没有在哪里可以找到meta content =“IE = 8.0000”或上面显示的!DOCTYPE It is very odd. 这很奇怪。

All my pages have: 我的所有页面都有:

<!DOCTYPE html> 

My main template has this: 我的主要模板有:

<!DOCTYPE html> 

<html   xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" 
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core">

Other pages have: 其他页面有:

<!DOCTYPE html>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                template="/layout/someFile.xhtml" >

Here are the things I have tried: 以下是我尝试过的事情:

1) Updated the Glassfish JSF to 2.1.17, since I read that there was a bug with older versions of Mojarra that caused it to ignore the DOCTYPE. 1)将Glassfish JSF更新为2.1.17,因为我读到旧版Mojarra存在一个错误导致它忽略了DOCTYPE。

2) I added: 2)我补充说:

<meta http-equiv="X-UA-Compatible" content="IE=9" > 

to every page, hoping it would enforce IE9, but this did not work. 每个页面,希望它会强制执行IE9,但这不起作用。

3) I then tried using content="IE=Edge", still no changes. 3)然后我尝试使用content =“IE = Edge”,仍然没有变化。

4) I changed my DOCTYPE to: 4)我将DOCTYPE更改为:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

unsure if XHTML needed this strict DOCTYPE to render properly. 不确定XHTML是否需要这个严格的DOCTYPE来正确渲染。 But this did not work. 但这没效果。

Any help would be great. 任何帮助都会很棒。 I have done a lot of research trying to sort this out, however I am new to web development, so I my understanding is quite limited. 我已经做了很多研究试图解决这个问题,但是我不熟悉Web开发,所以我的理解非常有限。

I added: 我补充说:

 <meta http-equiv="X-UA-Compatible" content="IE=9" > 

to every page, hoping it would enforce IE9, but this did not work. 每个页面,希望它会强制执行IE9,但这不起作用。

According to the MSDN document on this meta tag, 根据此meta标签上的MSDN文档

The X-UA-Compatible header isn't case sensitive; X-UA-Compatible标头不区分大小写; however, it must appear in the header of the webpage (the HEAD section) before all other elements except for the title element and other meta elements. 但是,它必须出现在除了title元素和其他元元素之外的所有其他元素之前的网页标题(HEAD部分)中。

this must appear before all other elements expect for <title> and other <meta> elements. 这必须出现 <title>和其他<meta>元素的所有其他元素之前 If you investigate the JSF/PrimeFaces-generated HTML closely, you'll see that there's a PrimeFaces specific <link> element before that which would block the X-UA-Compatible header from doing its job. 如果你仔细研究JSF / PrimeFaces生成的HTML,你会发现之前有一个PrimeFaces特定的<link>元素会阻止X-UA-Compatible标头完成它的工作。

PrimeFaces supports several facets for the <h:head> so that you can control the ordering of the head resources. PrimeFaces 支持 <h:head>多个方面,以便您可以控制头资源的排序。 The following should do it for you: 以下内容应该为您做到:

<f:facet name="first">
    <meta http-equiv="X-UA-Compatible" content="IE=9" /> 
</f:facet>

Again, this is specific to PrimeFaces, not to standard JSF. 同样,这是针对PrimeFaces的,而不是标准的JSF。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM