Monday, May 21, 2012

How to do i resolve "Resource interpreted as Script but transferred with MIME type text/html"

I use Django for my applications, and for some strange reasons a new project am working on has started mis-behaving with the following error when I try to load the page on a browser.




Resource interpreted as Script but transferred with MIME type text/html: "http://127.0.0.1:8000/site_media/js/jquery-1.7.js"




my view looks like this;



@csrf_exepmt
def home(request):
render_to_response("myapp/home.html",{}, context_instance=RequestContext(request))


My HTML template:



<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Home</title>
<script type="text/javascript" src="jquery-1.7.js"></script>
</head>
<body>
<h1>Welcome Home!</h1>
</body>
</html>


I have never seen anything like this in the past for any of my projects.



I am testing on Windows, Chrome 18.0. I have also tried on FF6 and Firebug is throwing some error on the first line of my html file.



All the suggestions from the net that I am trying are not working.



I have also tried to use the technique of supplying the MIME type manually via the django render shortcut but with no luck.



What am I missing? My other projects are working normally, even without the MIME settings.



Note: If I leave the "src" attribute of the script tag empty, the page loads well.





No comments:

Post a Comment