【问题标题】:Why does the <%@ include directive render correctly in IE but not Firefox or Chrome(latest versions)为什么 <%@ include 指令在 IE 中正确呈现,但在 Firefox 或 Chrome 中不正确(最新版本)
【发布时间】:2011-08-05 15:04:08
【问题描述】:
我正在尝试使用以下语法包含一个 html 文件:
<%@ include file="path/to/file.html" %>
但我在使用 Firefox(最新)和 Chrome(最新)浏览页面时遇到问题,可能还有其他我没有测试过的问题。据我所知,这包括在 IE 9 上运行良好。
谁能解释一下?
注意:
父文件是 index.html,我怀疑该包含指令仅适用于 *.jsp 文件,但我无法确认这一点,因为我在一个只有读取权限的目录中工作!
【问题讨论】:
标签:
html
jsp
include
directive
【解决方案1】:
父文件是index.html
将其重命名为index.jsp。这样<%@include%> 就会运行。它是 JSP,而不是 HTML。 JSP 运行在网络服务器上,而不是网络浏览器上。 Webbrowser 只理解 HTML。 -for the webbrowser- unknown <%@include%> 标签的解释取决于所使用的 webbrowser,未确定。