6
votes

while building a debug toolbar in Django I am getting an error in file toolbar.js ie. s.map: HTTP error: status code 404, net:: ERR_UNKNOWN_URL_SCHEME toolbar.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.

can anyone tell me the possible fix for that?

4
Do you use Django Debug Toolbar or build your own solution?Dmitry Belaventsev
I used Django Debug Toolbar and try to build a Django debugger by taking references from some articles, documentation, and video tutorial.Nkgupta
Ok, in the meantime we need more information to help you. Is that toolbar.js file was created by you or it's the part of DDT (django debug toolbar)? Also, we should take a look on your template where you add that file. Please add the required information to your question.Dmitry Belaventsev

4 Answers

14
votes

I found solution here How to set content type of JavaScript files in Django

#settings.py
if DEBUG:
    import mimetypes
    mimetypes.add_type("application/javascript", ".js", True)
12
votes

Expanding on drewslee answer

The solution to the problem is indicated in the documentation

  • For Windows, you need to edit the registry. Set HKEY_CLASSES_ROOT\.js\Content Type to text/javascript.
2
votes

I have faced the problem and it was fixed after edit the Windows registry. I just Set HKEY_CLASSES_ROOT.js\Content Type from text/plain to text/javascript.

Now the problem is solved!

0
votes

I faced the same error. It was resolved once I updated the HKEY_CLASSES_ROOT.js\Content Type from text/plain to text/javascript in my Windows using RegistryEditor.

After that I had to refresh my browser cache to be able to see the toolbar