html 尝试在Google Chrome中运行代码时出错[已关闭]

z9smfwbn  于 2022-12-09  发布在  Go
关注(0)|答案(1)|浏览(123)

编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
1小时前关闭。
Improve this question
我得到以下错误时,运行代码在我的本地主机使用谷歌浏览器.

    • 我可以在使用Safari时查看工作代码,但在使用Chrome时无法查看!**

127.0.0.1/:55 GET http://127.0.0.1:5500/app.js/ net::ERR_ABORTED 500 (Internal Server Error) :5500/?task=#:1 Refused to execute script from 'http://127.0.0.1:5500/app.js/' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Task List</title>

    <!-- Compiled and minified CSS -->
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
    />

    <script
      src="https://kit.fontawesome.com/83486dfd83.js"
      crossorigin="anonymous"
    ></script>
  </head>
  <body>
    <!-- removed, not important -->
    <script
      src="https://code.jquery.com/jquery-3.6.1.js"
      integrity="sha256-3zlB5s2uwoUzrXK3BT7AX3FyvojsraNFxCc2vC/7pNI="
      crossorigin="anonymous"
    ></script>

    <!-- Compiled and minified JavaScript -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

    <script src="app.js"></script>
  </body>
</html>
xbp102n0

xbp102n01#

我读了代码,我发现它确实使用了bootstrap,但你没有将链接添加到bootstarp文件的head中:

<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">

相关问题