-
Notifications
You must be signed in to change notification settings - Fork 712
css file is being called twice when prefixfree is activated #198
Comments
PrefixFree (and any other CSS polyfll) has to request the CSS file twice, through XHR, to be able to process it, as browsers drop everything they don’t understand in the CSSOM. However, virtually everyone will have cache enabled, so it should be pretty quick, as it will load from the cache the second time. |
thanks for responding. |
Yeah. People often disable cache on development environments, to test the initial loading speed of a website, maybe you did that at some point? Or maybe you disabled it in the local dev tools? |
I've just noticed in Webkit's timeline that my stylesheets are being loaded twice. I get the need for that through XHR but what's curious is every single page loads the style sheet is loaded twice through HTTP and XHR — and Webkit's timeline shows they are never cached. If I remove prefixfree from my scripts then the style sheet caches as normal. I appreciate this probably isn't a prefixfree issue per se but have you any idea why this might be? I haven't explicitly disabled cache per your comment above. Thanks! |
In reference to the above (and in case anyone has the same concern): I was profiling this in Safari and it was reporting that the style sheet was loading both times (not from cache) when including prefix free. However, out of curiosity I just checked in the Firefox profiler and it works as expected — no caching — which is excellent news! Is this a known bug with the Webkit profiler? It seems to do exactly the same for Typekit too. UPDATE: It works fine in Chrome too so it seems to be related to Safari only (7.0.5). |
fyi, i am not disabling the caching in the dev tools applet. i am still experiencing this same issue in firefox (all the versions i have tested above 30). though i am also finding that other files, such as images are not being properly cached either.. so this may be due to some other issue i am unaware of.. |
i am using prefixfree on a site built using the elgg.org framework for social nets.
i have noticed that the main css file for my theme is being called twice - once correctly and then again at the end of the page loads.
as i traced the cause of this, i found (via firefox's network tab in the inspector) that the 2nd call/load of the css file references an Accept parameter that differs from the 1st call:
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"
whereas, the 1st is:
Accept: "text/css,/;q=0.1"
i found this thread where someone was experiencing a similar issue (https://groups.google.com/forum/#!topic/firebug/JSDYpbVZ2hc) and in that case, the css file was self-referencing due to an empty url parameter in the css file for a background tag. the css file was calling itself as an image!
in my case, the 2nd call shows that somewhere, the code is expecting an html or xml file. though i do not know where.
the cause of this is definitely within or triggered through prefixfree, since when i disable prefixfree, the double loading stops.
anyone know how to resolve this?
thanks
The text was updated successfully, but these errors were encountered: