简体   繁体   English

样式不适用于Tomcat Web应用程序中使用window.open加载的HTML页面

[英]Styles not applied to HTML pages loaded using window.open in Tomcat web application

I am trying to load a help page in a new popup window as shown in the code below: 我正在尝试在新的弹出窗口中加载帮助页面,如下面的代码所示:

<a href="#" onclick="window.open('/abc.htm', null,'width=500px,height=600px,scrollbars=yes,resizable=yes');" >
    <img src="/images/icons/xyz.gif" valign="middle" border="0"/>
</a>

My application is a J2EE web application deployed on Tomcat 8. The web pages for the help files are HTML files present in the root directory in the webapps folder in Tomcat. 我的应用程序是部署在Tomcat 8上的J2EE Web应用程序。帮助文件的网页是Tomcat的webapps文件夹的根目录中的HTML文件。 The stylesheets and JavaScripts are stored in sub folders in the root directory. 样式表和JavaScript存储在根目录的子文件夹中。

My issue is that when the help page is loaded none of the styles are applied to it. 我的问题是,在加载帮助页面时,没有样式适用于该页面。 However if I am loading the help file by double clicking on it then all the styles are applied. 但是,如果我通过双击加载帮助文件,则将应用所有样式。 Only when it is loaded through Tomcat I am having this issue. 仅当它通过Tomcat加载时,我才遇到此问题。

The chrome console is showing the below warning: chrome控制台显示以下警告:

Resource interpreted as Stylesheet but transferred with MIME type text/html: " http://localhost:8080/Skins/Default/Stylesheets/Styles.css ". 资源被解释为样式表,但以MIME类型text / html传输:“ http:// localhost:8080 / Skins / Default / Stylesheets / Styles.css ”。

Can somebody please explain what am I doing wrong here? 有人可以解释一下我在做什么错吗?

I had a <!DOCTYPE html> at the top of my page. 我在页面顶部有一个<!DOCTYPE html> I removed that and it worked!! 我删除了它,它起作用了!

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

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