The CSS file was not applied because the mime type did not match (Error code: SEC711

I am currently working on a JSP-Servlet application. I have successfully deployed the application using Eclipse with the default Tomcat 7 server.

However, upon deployment, I noticed that the UI renders properly in Chrome and Firefox but encounters issues in IE10 or later. The console displays a warning stating:

SEC7113: CSS was ignored due to mime type mismatch

This is how the CSS files are referenced in the application:

<!DOCTYPE html>
<html>
    <head>
        <title>Test</title>
        <link rel="shortcut icon" href="images/rpt.ico" type="image/x-icon">
        <link href="css/custom.css" rel="stylesheet" type="text/css" />
    </head>
...............
</html>

I am seeking advice on how to resolve this issue. Interestingly, when running the site in Compatible mode, it renders fine. However, I want to find a solution that works even without Compatibility Mode enabled.

One observation is that the Type is not being detected as text/css. But why is this happening?

Answer №1

Alright,

After realizing that I couldn't achieve what I needed from the server side [tomcat] and even after trying with web.xml, I finally discovered a solution using a Filter Implementation.

   @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) res;
        if(request.getHeader("accept")!=null && request.getHeader("accept").contains("css")){
            response.setHeader("Content-Type", "text/css");
        }
        chain.doFilter(req, response);
    }

I made sure to explicitly specify text/css for css requests. And voila, it started working like a charm.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for sending an HTML form through Ajax, storing the data in a file, and then showcasing the results in a div

Embarking on my journey in Web Development, I am currently delving into JavaScript (specifically JQuery) and have decided to kick things off with a Simple Chat project. However, I'm facing an issue with preventing the page from refreshing after a mess ...

What is the proper way to retrieve this stylesheet and add it to the header of my HTML file?

I want to utilize a style sheet from Wikipedia. However, when I fetch the style sheet and attempt to pass the URL retrieved through AJAX to the head of my HTML document, the URL behaves unexpectedly. Initially, I tried to use the fetched URL directly: var ...

Trouble getting CSS and Javascript to bind when dynamically appending HTML elements

Attempting to dynamically bind HTML from an Angular controller SkillsApp.controller('homeController', function ($scope, $http, $q, $timeout) { $scope.getAllCategories = function () { $http({ url: "/Categories/GetAllCategories", ...

Tips for inserting a value into an HTML field using ASP.NET code behind

Recently, I created an application in JavaScript by utilizing HTML fields in ASP.NET. Due to some issues with the IDs, I had to resort to using HTML fields instead of ASP text boxes. Surprisingly, the HTML fields are functioning well with JavaScript. Now ...

What steps should I follow to make a sticker adhere to a div?

I'm currently in the process of designing a sticker that attaches to the top of a div, much like this: https://i.sstatic.net/aG329.png <div className="upgrade-premium"> <div className="upgrade-team"> <h1>Prem ...

Different ways to modify the CSS file of the bx-slider plugin for multiple sliders within a single webpage

Currently in the process of building a website using bx slider. I am looking to incorporate three sliders onto a single page for sliding HTML content. Initially, I added a bx slider to the page and customized it using CSS. I made modifications within jqu ...

Obtaining the identifier of the grandparent element that is of the "

I'm working on a project where I have a dynamic element called .courseBox. It's an <li> element that will be placed within a <ul> container. Each .courseBox has a red "x" button that, when clicked, removes it from the <ul>. Here ...

Adjust the color of the text depending on the background it is displayed on

While practicing HTML and CSS as I normally do, I decided to work on a PSD template yesterday. Initially, it seemed straightforward, but soon I encountered the issue I'm currently facing. Specifically, I am trying to change a specific part of text ba ...

Is there a way to make jQuery insert a placeholder before the image fades in?

I've implemented a fading effect on elements in my page using the following script: $(document).ready(function() { $('#holder').delay(650).fadeIn(1000); $('#sidepanelHolder').delay(650).fadeIn(1000); $( ...

In JavaScript, it is necessary to determine if a checkbox is checked when modifying an input box

I have a table where each <td> contains an input box and a checkbox like this: <td> <input class="Comment" type="text" data-db="comment" data-id="{{uid}}"/> <input type="checkbox" id="summary" title="Check to set as Summary" / ...

Modify the background of the parent component when hovering in ReactJS

Here is my React code snippet that I am working with: Code My goal is to change the background of the App component to the "E-commerce" picture when hovering over it. This should apply to all other pictures as well. Any assistance in solving this issue ...

What is the best way to align a submit button and select option in a row within a form using Bootstrap?

I'm having trouble aligning a submit button to the right within a Bootstrap form. I've experimented with float-right, text-right, and align="right", but none of them seem to be working. Below is the code snippet: <!DOCTYPE html& ...

Steps to invoke a function repeatedly for an animation

I found this code snippet while browsing a forum post about CSS animations. The question asked if it was possible to create a button that would restart the animation when clicked, even if it is in the middle of playing. They specifically requested no jQu ...

What could be causing my divs to not properly handle overflow with the overflow-y scroll property?

I'm struggling with making my sidebar and content area responsive in terms of height. I want them to adjust to fill the screen appropriately, rather than having a fixed height. The issue arises when I have varying content heights, such as when a page ...

Exploring CSS shaders in a browser?

Which browser out there fully supports CSS shaders? ...

Uploading multiple files with unique IDs into a table

Currently, I am attempting to modify the code found at: This code functions perfectly with a single file input (and has been utilized in various projects without any issues). My specific requirement is to generate a table with a file input within each ro ...

`The Conundrum of Basic HTML Parsing`

Hello, I am currently working on extracting professor names and comments from the ratemyprofessor website by converting each div into plaintext. The following is the structure of the div classes that I am dealing with: <div id="ratingTable"> <div ...

Divider separating each item within the ListBox

In order to create a table-like appearance in my ListBox control, I prefer to include a separator line between the items. This helps differentiate each item and gives the illusion of having one column with multiple rows. ...

Retrieving and storing information from a form without the need to submit it

I have been given the task of creating a load/save feature for a complex form. The goal is to allow users to save their progress and resume working on it at a later time. After much consideration, I have decided to implement server-side storage by saving ...

How to create a dynamic background color animation in jQuery similar to a progress bar animation

I have a container with text content (for example: My Name) and it is displayed in a RED background color along with a button. What I am looking for : When the button is clicked, I want to change the background color of the container from RED to BLUE, si ...