Skip to main content
November 18, 2009
Question

css files dont load on session start on cfm pages

  • November 18, 2009
  • 2 replies
  • 783 views

I've googled for this on more than one occasion and it's been happening to me since MX7, I have a site running on Coldfusion (dev CF9 (dev version) Apache 2.2.12, production CF8 IIS) and on session start the css files don't load, but as soon as you refresh they're there.

My Application loads 4 components on session start, if that helps.

This only happens on session start with cfm files. The links to the css files are there, but they're just not being called (net tab in firebug confirms this). It happens across all browsers on my dev and on my production.

The only common denominators in all scenarios is coldfusion.

Until now I've been getting around this by using cflocation on session start to reload the page, but as of 8 cflocation passes a 301 status code by default, and only lets you pass 301-307 codes using the statuscode attribute. Because of this Google won't index any of the site's pages.

edit: So I noticed that on session start not all the content loads, it's weird the text loads piecemeal some is there some isn't including the head tags...

    This topic has been closed for replies.

    2 replies

    November 18, 2009

    I figured it out! I assumed it was only the css files not loading, because that was the most noticeable symptom. But after inspecting the broken markup I noticed only things inside cfoutput tags were being output, which means there was a wayward <cfsetting enablecfoutputonly="yes"> without a matching <cfsetting enablecfoutputonly="no">. I did a full site search in dreamweaver, but couldnt find the offending tag, so I just put a <cfsetting enablecfoutputonly="no"> at the bottom of onSessionStart in my Application.cfc and it seems to work now!

    This has been killing me forever and of course it took posting about it on the forums to get me to figure it out!

    Thanks for the responses guys!

    ilssac
    Inspiring
    November 18, 2009

    Glad you found the cause.

    If you care for any future developer that will work on this code a few months or years down the road, including yourself as one of these potential future developers, you may want to track down that arrent tag.  At least comment clearly what you have just added this strange tag for no clearly apparent reason.

    But it always feels good to know what is going on.

    ilssac
    Inspiring
    November 18, 2009

    Your last comment is the only one that makes any sense.

    It sounds like during an onSessionStart, somehow your system is not returning a complete and proper HTML document?  Is it possilbe that the docuement is so mangled that the browser does not know it is supposed to parse the CSS links?

    Otherwise ColdFusion should have no barring on this.

    1) CF builds an HTML HTTP resonse from the CFML code

    2) The HTML is returned to the web server.

    3) The web server returns the HTML to the browser.

    4) The browser parsed the HTML sees CSS links

    5) The web browser requests the CSS content from the web server

    6) The web server returns CSS content.

    The only way I can see ColdFusion affecting this is that what is returned in step 1 can not be parsed by the browser for the CSS.

    Inspiring
    November 18, 2009

    Agreed.

    I'd take the resultant mark-up and eyeball it for stuff that's not supposed to be there, and probably run it through the W3C mark-up validator as well.

    I'd also look at what requests the browser is actually making (with an HTTP sniffer), and see what's happening there...

    CF has no bearing whatsoever on how a browser requests or renders CSS files.

    --

    Adam