----- Weitergeleitet von Peter Köhler/BN/DWD am 15.01.2020 15:50 -----

Von:    Peter Köhler <peter.koeh...@dw.com>
An:     "Tomcat Users List" <users@tomcat.apache.org>
Datum:  15.01.2020 15:49
Betreff:        Antwort: Tomcat9, JSP, CSS and JS not loading in Firefox



Von:    Léa Massiot <lmhe...@orange.fr>
An:     users@tomcat.apache.org
Datum:  15.01.2020 15:40
Betreff:        Tomcat9, JSP, CSS and JS not loading in Firefox



Hello,

My question is about loading a JSP page in Firefox (or Google Chrome) and
not having the CSS loaded and the JS operational.

I am using Tomcat v9.0 and Eclipse Java EE IDE v.2019-12 (4.14.0).
When I'm developing using Eclipse IDE, I usually:
- select a JSP in the "WebContent" directory in the Eclipse workspace, 
- right-click, 
- select "Debug/Run As -> Debug/Run on Server"
and the Webapp starts debugging/running.

With the URL "http ://localhost/<webapp_name>/<page>.jsp", the page gets
displayed correctly in the Web browser that Eclipse "embeds" (maybe I.E., 
I
don't know).
In Internet Explorer, the page is displayed correctly too.

Now, if I copy this same URL "http ://localhost/<webapp_name>/<page>.jsp" 
in
Firefox or Google Chrome, it's like the CSS is not applied to the page, 
and
the Javascript code doesn't run when it should.

Note that I didn't use to have that problem before I upgraded Eclipse and
Tomcat (I used Tomcat v.8 before).

Below is the beginning of the JSP page:

----------------------------------------------------------
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http ://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;http ://www.w3.org/TR/html4/loose.dtd&quot;>
<html lang="${initParam['S_IF_MSG_HTML_LANG']}">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="icon" href="images/imw.ico?v=2" type="image/x-icon" />

    <link rel="stylesheet" type="text/css" href="css/fo.css" />

 

    <title>
      ${initParam['S_IF_MSG_TITLE_WELCOME']}
    </title>

    <meta name="description"
content="${initParam['S_META_DESCR_WELCOME_PAGE']}" />
  </head>
----------------------------------------------------------

Also in Firefox, I pressed Ctrl + Shift + k and saw the error message:
----------------------------------------------------------
The stylesheet http ://localhost/fr/css/fo.css was not loaded because its
MIME type, “text/html”, is not “text/css”.
----------------------------------------------------------

and the warning:
----------------------------------------------------------
The script from “http ://localhost/fr/js/fo.js” was loaded even though its
MIME type (“text/html”) is not a valid JavaScript MIME type.
----------------------------------------------------------

Can you help me solve that problem? 

Best regards.
--
Léa

P.S. I added a space after each occurrence of the pattern "http" in this
message.



--
Sent from: http://tomcat.10.x6.nabble.com/Tomcat-User-f1968778.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Dear Lea,

maybe 
https://stackoverflow.com/questions/48248832/stylesheet-not-loaded-because-of-mime-type
 

helps.

Regards

Peter


Reply via email to