not loaded because its MIME type, "application/x-javascript", is not "text/css"

Posted on 2009-04-28
Medium Priority
Last Modified: 2012-05-06
Error: The stylesheet http://***.js?48349 was not loaded because its MIME type, "application/x-javascript", is not "text/css".
Source File: http://****.js?adxq=1239123669

The problem is that the JS file thats ?not? being loaded is not included in the Source File, and both source files are defined as script type='text/javascript'. A little perplexed on this one.
Probably not.

Open in new window

Question by:seanmccully
  • 3
  • 3
LVL 39

Expert Comment

by:Roger Baklund
ID: 24254725
Can you provide some context? What kind of system is this? Can you show some source code?

The error message indicates that a CSS file was expected, but a javascript file was provided.

Author Comment

ID: 24254753
I cant really show the source, but when I see the error now it says the Source File is just the html page that contains the script tag. Does this eliminate the second JS as a problem? Also I can really show the source cause its kinda belongs to a third party vendor. But the javascript is included as such,

<script src="***" type="text/javascript"></script>

And when I view the headers on the file are

HTTP/1.x 200 OK
Date: Tue, 28 Apr 2009 20:18:37 GMT
Server: Apache/2.2.4 (Unix) PHP/5.2.3
Last-Modified: Tue, 28 Apr 2009 00:57:13 GMT
Etag: "d21a2-23d94-f17f2c40"
Accept-Ranges: bytes
Content-Length: 146836
Connection: close
Content-Type: application/x-javascript

LVL 39

Expert Comment

by:Roger Baklund
ID: 24254949
Where is the error coming from? The browser, the web server, or the application? Or somewhere else? Where do you see the error? In the browser (on the page or in popup?), in web server logs, in application logs, or somewhere else?

A <script> tag is supposed to load a javascript into the browser, Content-type: application/x-javascript is normal for such a request. The error indicates a CSS file was expected, but a javascript was delivered by the web server. CSS files are normaly loaded with <link> tags or @import() statements within <style> tags.

I did not ask for ALL the source code, just a snippet to show us what you are doing. You can obfuscate paths, file names and any other identifiers.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 24255076
What would you like to see, besides the script tag for loading the JS there isnt much else much involved. I even created a blank html file that simply loads the JS in the script tag and error is still generated. The javascript file just generates some html and appends to DOM. Which it does, but the browser (Firefox 3.0.9) is generating this error in the Error Console.
LVL 39

Accepted Solution

Roger Baklund earned 500 total points
ID: 24255248
The html generated by the javascript, does it contain a <link rel="stylesheet" ... > tag or a <style type="text/css"> tag with an @import() statement within it?

The error means a javascript was returned from the server when a css file was expected.

Author Closing Comment

ID: 31575656
Yes, I figured out what is causing the problem. Thanks!!.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question