Disable Chrome strict MIME type checking

前端 未结 6 1807
青春惊慌失措
青春惊慌失措 2020-11-28 08:10

Is there any way to disable strict MIME type checking in Chrome.

Actually I\'m making a JSONP request on cross domain. Its working fine on Firefox but,

6条回答
  •  迷失自我
    2020-11-28 08:30

    In case you are using node.js (with express)

    If you want to serve static files in node.js, you need to use a function. Add the following code to your js file:

    app.use(express.static("public"));
    

    Where app is:

    const express = require("express");
    const app = express();
    

    Then create a folder called public in you project folder. (You could call it something else, this is just good practice but remember to change it from the function as well.)

    Then in this file create another folder named css (and/or images file under css if you want to serve static images as well.) then add your css files to this folder.

    After you add them change the stylesheet accordingly. For example if it was:

    href="cssFileName.css"
    

    and

    src="imgName.png"
    

    Make them:

    href="css/cssFileName.css"
    src="css/images/imgName.png"
    

    That should work

提交回复
热议问题