放在元素内部的首位?,internet-explorer,jsf,bootsfaces"/>

首页 > 解决方案 > 如何确保放在元素内部的首位?

问题描述

我正在尝试解决以下问题:当我在 IE 中访问我的应用程序时,它会自动以 IE7 文档模式打开,而不是在 IE9 中打开。经过一番研究,我在这个网站上发现了一些信息:https ://code.i-harness.com/en/q/f10390 ,我知道我必须从中放置

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"></meta>       

<head>元素中排在第一位。我相信我正在做的。但是,当呈现页面时,我在模板中定义的所有元素h:head都被放置在 bootsfaces 需要的其他 css 和 js 之后(jquery..etc)。

我什至在 web.xml 中添加了如下内容,因为它似乎需要覆盖

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"></meta>       


<context-param>
  <param-name>BootsFaces_USE_VIEWPORT</param-name>
  <param-value>false</param-value>
</context-param>

我的模板:

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"  
   xmlns:h="http://java.sun.com/jsf/html"   
   xmlns:f="http://java.sun.com/jsf/core"   
   xmlns:ui="http://java.sun.com/jsf/facelets"  
   xmlns:b="http://bootsfaces.net/ui"       
   xmlns:ds="http://deltaspike.apache.org/jsf">
   <f:view contentType="text/html" encoding="UTF-8" >
     <h:head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"></meta>       
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <title>My System</title>
        <h:outputScript library="mySystem" name="js/mySystem.js" position="last" />
        <h:outputStylesheet library="mySystem" name="css/mySystem.css" position="last" />
     </h:head>
     <h:body>
       <ds:windowId />
          ...

有没有人能够启发我如何在 IE9 文档模式下实现所需的打开,或者如何实现生成 html,其中< meta http-equiv .../>是 head 元素内的第一行。提前致谢。

标签: internet-explorerjsfbootsfaces

解决方案


好吧,一旦我找到解决方案,我会回答。不确定它是否是最好的:

我设法强制<meta>节点排在第一位,使用

<f:facet name="first">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
</f:facet>

我在这里找到了答案。 如何使元标记成为 <head> 部分中的第一个?


推荐阅读