jrbneto
#1
Olá,
Antes meus projetos Spring funcionavam normalmente, só que começou a ter esse erro no front-end:
“Refused to execute script from ‘http://localhost:8080/meuprojeto/resources/js/bootstrap.min.js’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.”
Só que em todos meus projetos Spring estão tendo esse mesmo erro para as bibliotecas js e css.
Estou utilizando Tomcat 7.0.
Porque está dando esse problema e como resolveria o mesmo ?
Grato por qualquer informação.
aparentemente quem serve este js não sabe criar o cabeçalho http correto com o mime type appropriado.
um .js não é um text/html e sim um application/javascript ( ou algo assim ).
jrbneto
#3
Esse é meu cabeçalho que está em um jsp
com as importaçõesjs
.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="security"%>
<html>
<meta charset="utf-8">
<title>Mapa de Impacto</title>
<c:url value="/resources/css" var="cssPath" />
<c:url value="/resources" var="jsPath" />
<link href="resources/styles/bootstrap.css" rel="stylesheet" />
<link href="resources/styles/impChamado.css" rel="stylesheet" />
<link rel="stylesheet"
href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="<c:url value="/js/jquery-2.2.1.js"/>"></script>
<script src="${jsPath}/js/mensagemDialog.js"></script>
<script src="${jsPath}/js/criadorDePagina.js"></script>
<script src="${jsPath}/js/capturaTipoSistema.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="resources/js/bootstrap.min.js"></script>
Tino_
#4
resolvi o problema colocando
<link rel="stylesheet" type="text/css" href="resources/styles/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="resources/styles/impChamado.css" />
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="<c:url value="/js/jquery-2.2.1.js"/>"></script>
<script type="text/javascript" src="${jsPath}/js/mensagemDialog.js"></script>
<script type="text/javascript" src="${jsPath}/js/criadorDePagina.js"></script>
<script type="text/javascript" src="${jsPath}/js/capturaTipoSistema.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="resources/js/bootstrap.min.js"></script>