Chrome says “Resource interpreted as script but transferred with MIME type text/plain.”, what gives?

后端 未结 20 2551
眼角桃花
眼角桃花 2020-11-22 07:21

In FF and all, my javascript works fine. But in Chrome it gives this message:

Resource interpreted as script but transferred with MIME type text/plai

20条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 08:11

    Weird issue, but this helped me to solve my issue. Sometimes even the easiest things are hard to figure out...

    Instead of using /js/main.css in my script-tag I used js/main.css

    YES, it did actually make a difference. I'm sitting on WAMP / Windows and I didn't have a vhost but just used localhost/

    If I reference to /js/main.css then I reference to localhost/css/main.css and not to localhost//css/main.css

    When you think of it, it's quite obvious but if someone stumbles upon this I thought I would share this answer.

提交回复
热议问题