Dynamically created ASP stylesheet not working in Firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahembry
    New Member
    • Mar 2012
    • 4

    Dynamically created ASP stylesheet not working in Firefox

    I've got a dynamically created stylesheet (I pass in variables for starting font size, header colors, etc.) that works perfectly in IE but is ignored in Firefox. This works in my current production environment but not in a major site revision (in testing now).

    Current Production:
    Code:
    <link rel="stylesheet" type="text/css" href="/include/styles.asp?d=<%= g_strDarkColor %>&m=<%= g_strMediumColor %>&l=<%= g_strLightColor %>&c=<%= g_strContrastColor %>&link=<%= g_strLinkColor %>&f=<%= g_intBaseFontSize %>" />
    Site Refresh:
    Code:
    <link rel="stylesheet" type="text/css" media="all" href="/include/styles.asp?d=<%= g_strDarkColor %>&m=<%= g_strMediumColor %>&l=<%= g_strLightColor %>&c=<%= g_strContrastColor %>&link=<%= g_strLinkColor %>&f=<%= g_intBaseFontSize %>&h=<%= g_strHeadingColor %>&r=<%= g_strRHTextColor %>&line=<%= g_strLineColor %>&sb=<%= g_strSeparatorBarColor %>&in=<%= g_intImageNumber %>&mi=<%= g_strNavBgImage %>" />
    I did already try removing the "media='all '" code...no different. Only real difference is the number of variables passed in.

    It seems to be directly related to the following, which is at the top of every page and is required to get some of the JQuery to work:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    Any ideas?
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Define "not working". It's not a technical term. Did it ever work in Firefox? By "production environment" I take it you mean locally and now it doesn't work on the server?

    Comment

    • ahembry
      New Member
      • Mar 2012
      • 4

      #3
      Not working meaning that it's not recognizing the stylesheet at all, so it defaults to standard (times new roman, size 12 perhaps).

      By production, I mean the web. It currently works on my site liveandworkwell .com in firefox (old code), but we don't have the <doctype> listed. We now have to have that to run JQuery but it's causing Firefox to not recognize the dynamic stylesheet.

      We customize the colors, font sizes, etc. for 2000+ clients using db and one set of code. The only fix I can think is to create separate stylesheets for each customization, but that makes customization labor intensive where right now it's done thru a web-based admin tool on the fly.

      Any advice is appreciated and welcome!

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        So is the stylesheet link showing up in the browser markup? Can you access it directly from the web? Can you post the link here?

        Comment

        • ahembry
          New Member
          • Mar 2012
          • 4

          #5
          The link does show up:
          Code:
          <link rel="stylesheet" type="text/css" media="all" href="/include/styles.asp?d=333333&m=FF0000&l=FF0000&c=FF0000&link=164072&f=20&h=F07915&r=666666&line=CCCCCC&sb=999999&in=1&mi=bg_1" />
          It is not accessible via web as it's sitting behind a firewall in our dev environment right now. If I convert the stylesheet to .css rather than .asp, Firefox picks it up just find. However, I really need it to recognize the .asp version so I can dynamically set the values.

          Comment

          • ahembry
            New Member
            • Mar 2012
            • 4

            #6
            I figured out (with help) and wanted to post the solution for anyone else that runs into this issue:

            The issue was that my page uses a <link> tag to incorporate the style sheet. Therefore, Firefox makes a separate request for styles.asp and it is retrieved independently as a completely separate page. So, styles.asp is being served with a content-type of text/html, which needs to be changed to text/css in that file itself.

            Within the styles.asp page...after the ASP code at the top of the page and JUST ABOVE THE ACTUAL CSS code...I had to add the following line:

            Code:
            <% Response.ContentType = "text/css" %>
            that took care of the issue. Whew!! Thanks for the help!

            Comment

            • drhowarddrfine
              Recognized Expert Expert
              • Sep 2006
              • 7434

              #7
              The issue was that my page uses a <link> tag to incorporate the style sheet. Therefore, Firefox makes a separate request for styles.asp and it is retrieved independently as a completely separate page.
              ALL browsers fetch external stylesheets as a separate page and MUST be served as text/css. Why IE was able to handle that might be attributed to it being a Microsoft product but that is not standard.

              Comment

              Working...