{"id":709,"date":"2011-12-19T05:16:36","date_gmt":"2011-12-19T05:16:36","guid":{"rendered":"http:\/\/www.gssezisoft.com\/main\/?p=709"},"modified":"2013-04-01T01:13:36","modified_gmt":"2013-04-01T01:13:36","slug":"chrome-browser-html5-and-dynamic-css-files","status":"publish","type":"post","link":"http:\/\/www.gssezisoft.com\/main\/2011\/12\/chrome-browser-html5-and-dynamic-css-files\/","title":{"rendered":"Chrome Browser, HTML5 and Dynamic CSS files"},"content":{"rendered":"<h2>Problem<\/h2>\n<p>I spent eight hours yesterday trying to get a webpage for another site working in HTML5. It just didn&#8217;t make the slightest bit of sense.<\/p>\n<p>I&#8217;d make changes to the CSS file and nothing would happen. I&#8217;d refresh and clear the browser cache but it still wouldn&#8217;t work. <!--more--><\/p>\n<p>Yet adding style to the element in the html file worked.<\/p>\n<p>The CSS file was there. You could even see it as a Resource in the Chrome Developer&#8217;s Tools.<\/p>\n<p>However, the Developer&#8217;s Tools was only showing some of the CSS information.<\/p>\n<h2>Cause<\/h2>\n<p>It turns out that Chrome ignores your CSS file if it isn&#8217;t served with a MIME type of &#8220;text\/css&#8221;; despite being in a tag that says &#8216;link rel=&#8221;stylesheet&#8221; type=&#8221;text\/css&#8221; href=&#8230;&#8217;.<\/p>\n<p>I&#8217;m not sure if it is only this fussy when you stick in a &lt;!DOCTYPE html&gt; tag (html5).<\/p>\n<h2>Solution<\/h2>\n<p>The CSS file was being generated by a PHP script on the server so the solution was to add a line at the top like:<br \/>\nheader(&#8216;Content-type: text\/css&#8217;);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem I spent eight hours yesterday trying to get a webpage for another site working in HTML5. It just didn&#8217;t make the slightest bit of sense. I&#8217;d make changes to the CSS file and nothing would happen. I&#8217;d refresh and clear the browser cache but it still wouldn&#8217;t work.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/posts\/709"}],"collection":[{"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/comments?post=709"}],"version-history":[{"count":0,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/posts\/709\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/media?parent=709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/categories?post=709"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gssezisoft.com\/main\/wp-json\/wp\/v2\/tags?post=709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}