Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting Resource interpreted as Script but transferred with MIME type text/html when I'm offline and requesting css and js files from AppCache
    primarykey
    data
    text
    <p>I am developing a web app in which I am trying to use the HTML5 application cache.</p> <p>I can successfully cache the files and load the files from AppCache while online. But when I go offline, all the css and js files are transferred with MIME type text/html instead of application/x-javascript or text/css, so it is not properly working on offline.</p> <p>This is what I get when I request a page while offline.</p> <pre><code>Application Cache Error event: Manifest fetch failed (-1) https://example.com/manifest Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://example.com/offline_assets/stylesheets/cache/offline_all.css". Resource interpreted as Script but transferred with MIME type text/html: "https://example.com/javascripts/offline/respond.min.js". Resource interpreted as Script but transferred with MIME type text/html: "https://example.com/javascripts/yui3/3.1.1/build/yui/yui-min.js". Resource interpreted as Script but transferred with MIME type text/html: "https://example.com/offline_assets/sprockets.js". </code></pre> <p>Therefore, the page is not styled and getting whole kind of JS errors.</p> <p>How can I properly set such that css and js files are transferred with a proper MIME type from appcache while offline? thank you for your suggestions</p> <p>Updated: this is how I serve the manifest file on the server</p> <pre><code>class ManifestController &lt; ApplicationController def show headers['Content-Type'] = 'text/cache-manifest' render :text =&gt; File.open("#{RAILS_ROOT}/public/manifest.appcache").read, :layout =&gt; false end end </code></pre> <p>and I have passed this validation test: <a href="http://manifest-validator.com/" rel="nofollow">http://manifest-validator.com/</a></p> <p>Here is my Manifest file:</p> <pre><code>CACHE MANIFEST #&lt; /offline_assets/stylesheets/cache/offline_all.css /offline_assets/fonts/websymbols-regular-webfont.woff /offline_assets/javascripts/yui3/3.1.1/build/yui/yui-min.js /offline_assets/sprockets.js /offline_assets/javascripts/offline/respond.min.js /offline_assets/images/logoClio.png /offline_assets/images/search/icoSearch.png /offline_assets/images/icoArrow-down.png /offline_assets/images/gold/submenu_current.png /offline_assets/images/calendar/left_arrow.gif /offline_assets/images/calendar/right_arrow.gif /offline_assets/images/calendar/left_arrow_on.gif /offline_assets/images/calendar/right_arrow_on.gif /offline_assets/images/calendar-lg.gif /offline_assets/images/logo-tagline.gif /offline_assets/images/icoRecent-matter.png /offline_assets/images/icoRecent-contact.png /offline_assets/stylesheets/yui/dt-arrow-dn.png /offline_assets/stylesheets/cache/sprite.png /offline_assets/images/timer_stop.png /offline_assets/images/add3.png /offline_assets/images/arrow_down.gif /offline_assets/images/spinner.gif /offline_assets/images/timer_start.png /offline_assets/images/delete.png /offline_assets/images/offline/logoClio.png /offline_assets/images/offline/bgSteps-1.png /offline_assets/images/offline/bgSteps-2.png /offline_assets/images/offline/bgSteps-3.png /offline_assets/images/offline/icoReload.png /offline_assets/images/offline/dt-arrow-dn.png /offline_assets/images/offline/sprite.png #&gt; # offline.html will be displayed if the user is offline and attempt to get uncached pages FALLBACK: / /offline.html # All other resources (e.g. sites) require the user to be online. NETWORK: * </code></pre> <p>And this is one of the cached file that shows MIME type and other details on chrome://appcache-internals/</p> <pre><code>https://staging.goclio.com/offline_assets/sprockets.js?cec750eb3581f3d9f78c97d0ad8331df HTTP/1.1 200 OK Server: nginx/0.8.55 Date: Fri, 09 Mar 2012 19:56:17 GMT Content-Type: application/x-javascript Last-Modified: Fri, 09 Mar 2012 19:51:10 GMT Expires: Thu, 31 Dec 2037 23:55:55 GMT Cache-Control: max-age=315360000 X-Backend-Server: 333963-web02.rs.goclio.com:81 Accept-Ranges: bytes Vary: Accept-Encoding, User-Agent Content-Encoding: gzip </code></pre> <p>Another update: this works fine on firefox without getting any MIME type error. Naoya</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload