Debug message “Resource interpreted as other but transferred with MIME type application/javascript”

前端 未结 15 1891
旧巷少年郎
旧巷少年郎 2020-11-29 01:50

OK, I understand what the messages means, but I\'m really not sure what\'s causing it. I\'m using Safari and the Web Inspector on Mac OS X, by the way.

I\'v

相关标签:
15条回答
  • 2020-11-29 02:09

    I don't think it is a bug, Try adding the MIME type to your .htaccess file For instance, put or add the following content to your .htaccess file (which should be in the same place of your .js or above folders)

    #JavaScript
    AddType application/x-javascript .js
    

    This solved my tree "Resource interpreted as other but transfered ... " warnings. Everytime you have that kind of warning it means you don't have enough info in your .htaccess file.

    BTW1: Since you are modifying .htaccess file, make sure you restart your server.

    BTW2: I also could clear same warnings for GIF files in Safari 4 with this:

    #GIF
    AddType image/gif .gif
    

    BTW3: For other file types: see w3schools list or htaccess-guide

    0 讨论(0)
  • 2020-11-29 02:11

    I just got this and solved it locally on my mac. For some reason the javascript file in question had bad permissions. I noticed when I looked at it in firebug I was getting a 403. I hope that helps anyone.

    0 讨论(0)
  • 2020-11-29 02:13

    I had the same issue with a css file instead of javascript. (using the xitami webserver)

    what fixed for me was adding under the MIME section of xitami.cfg:

    css=text/css

    0 讨论(0)
  • 2020-11-29 02:13

    On APACHE

    Append these MIME types to .htaccess in your root. I recommend the second line, as it may help prevent any future potential MIME interpretation warnings with CSS files.

    AddType application/x-javascript .js
    AddType text/css .css    
    

    Restart Your Apache...

    On NGINX

    Add to your nginx.conf or your mime.types import file (Recommended Method). Add any or all as needed/relevant.

    types {
        text/html                             html htm shtml;
        text/css                              css;
        text/xml                              xml;
        image/gif                             gif;
        image/jpeg                            jpeg jpg;
        application/x-javascript              js;
        application/rss+xml                   rss;
        text/plain                            txt;
        image/png                             png;
        image/tiff                            tif tiff;
        image/svg+xml                         svg svgz;
        image/webp                            webp;
        application/postscript                ps eps ai;
        application/pdf                       pdf;
        application/rtf                       rtf;
        application/vnd.ms-excel              xls;
        application/vnd.ms-powerpoint         ppt;
        application/msword                    doc;
        application/x-shockwave-flash         swf;
        application/xhtml+xml                 xhtml;
        application/zip                       zip;
    }
    
    0 讨论(0)
  • 2020-11-29 02:16

    seems to be a bug in safari / webkit. maybe this one, or any of these. try upgrading your safari. if there is no more recent stable version, try the 4 beta.

    0 讨论(0)
  • 2020-11-29 02:18

    This warning appears because no default script type is specified. Try adding the following directive to your HTML file:

    <meta http-equiv="content-script-type" content="text/javascript">

    You can read more about default scripting specifications here: http://www.w3.org/TR/REC-html40/interact/scripts.html#h-18.2.2.1

    0 讨论(0)
提交回复
热议问题