By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Dynamically created ASP stylesheet not working in Firefox

P: 4
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:
Expand|Select|Wrap|Line Numbers
  1. <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 %>" />
  2.  
Site Refresh:
Expand|Select|Wrap|Line Numbers
  1. <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 %>" />
  2.  
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:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
Any ideas?
Mar 13 '12 #1
Share this Question
Share on Google+
6 Replies


drhowarddrfine
Expert 5K+
P: 7,435
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?
Mar 13 '12 #2

P: 4
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!
Mar 14 '12 #3

drhowarddrfine
Expert 5K+
P: 7,435
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?
Mar 15 '12 #4

P: 4
The link does show up:
Expand|Select|Wrap|Line Numbers
  1. <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.
Mar 15 '12 #5

P: 4
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:

Expand|Select|Wrap|Line Numbers
  1. <% Response.ContentType = "text/css" %>
that took care of the issue. Whew!! Thanks for the help!
Mar 16 '12 #6

drhowarddrfine
Expert 5K+
P: 7,435
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.
Mar 17 '12 #7

Post your reply

Sign in to post your reply or Sign up for a free account.