Forum Moderators: open

Message Too Old, No Replies

MIME type (text/plain) is not a valid JavaScript MIME type

         

csdude55

12:05 am on Aug 23, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm using <script src="...foo.js"></script> to import a script from a third party. It looks like it's working on my end, but they're seeing the following error:

The script from "https://...foo.js" was loaded even though its MIME type ("text/plain") is not a valid JavaScript MIME type.


I can't see anything on my end that would have caused this error.

What do you think, is there anything I could have done on my end or would this have to be an error in the script itself? Or, more likely, with their server?

phranque

8:35 am on Aug 23, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



what is the value of the Content-Type HTTP Response header?
it should be set by the server or the app to "text/javascript".

lucy24

4:25 pm on Aug 23, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The problem is at the third party’s end. If it's someone you know, ask them to fix it. Otherwise, since it works anyway, put it in the “no skin off my nose” bin.

But wouldn't it save a step if you downloaded the script and put it on your own server, so users (i.e. users' browsers) don't have to take the extra step of locating this other site? (I would ask the same question about, say, third-party fonts.)

csdude55

6:00 pm on Aug 23, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is an ad network that I'm using. The ads are showing up on my end and look good, but the reports on their end are empty :-O I emailed them and was hoping that it was just a reporting bug, but they replied and said that they were seeing the MIME error and that I would need to fix it.

But like you both said, I was 90% sure it was on their end!

@lucy24, I'm sure that it would, but I can never be sure when they change something :-/