Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

Comments for: tim20000821

Message # 1015060:
Date: 01/09/03 04:00
By: Scott Davey
Subject: Server-side css generation is not a good idea

Hi,

Server-side generation of css files is not a good idea. Here's some direct experience to explain why...

Last year my company built a site with dynamic CSS files that did browser detection and customised the style sheet appropriately, similarly to the way this article describes it.

Following the launch, the site developed an intermittent problem for some users where the fonts would sometimes appear smaller, but refreshing would fix it.

This occurred in different sites, but one site in particular had it bad. We could not reproduce it at our office, which made matters worse.

After a few months, we ended up working out what was going on.

When a Netscape 4 browser viewed the site, it would request the HTML file and the CSS file, which of course would be customised to NS4.

When a user in the same netork using IE4 requested a page from the site, it would also request these files.

However, their proxy server was transparently proxying all files, and had already cached this file. The fil was subsequently delivered to the IE user in netscape format.

The IE user would then hit 'refresh' which would cause the proxy server to get the IE version - of course the Netscape user would then get big fonts next time they visited the site :(

Even setting header directives to not cache the file did not seem to fix it - the proxy server was too arragant and cached it anyway.

Our solution was to create different css fils for different browsers - style_ie.css, style_ns.css, etc.

We then set the HTML page to reference the appropriate css page. This solution solved our problems.

Their proxy server was Squid, which is one of the most popular proxies on the internet. It was part of a commercial firewall product.

Our solution also had the side effect of speeding up page loads and rendering, as the css file doesn't have to be built each time.

I hope this helps others battling the browser style wars....

Scott

Previous Message | Next Message


Comments:
RE: javascript:history.back()Mike01/13/06 08:45
RE: javascript:history.back()Srinivasan11/18/04 03:21
RE: javascript:history.back()Alex Livingstone04/17/04 00:21
updating for netscape 4+/7abbey01/30/03 14:27
RE: Browser detection and CSSBradley Jareczek01/15/03 21:04
alternative for browser detectionBradley Jareczek01/15/03 21:02
Server-side css generation is not a good ideaScott Davey01/09/03 04:00
Getting the code in Tim's article to workNorman Graham12/16/02 07:01
RE: How get the client screen size?Christian12/03/02 02:39
css doesn't need php to detect the browserKristof Neirynck11/06/02 03:57
RE: Sniffer codeHirvi10/14/02 19:45
PHP & CSS - A Step FurtherJohn Krische09/17/02 23:56
Browser detection and CSSPraggers08/09/02 06:09
RE: The (in)famous CSS trickChris Berry06/09/02 10:14
RE: how to implement this?ars06/06/02 16:28
php CSS GeneratorHarry Fuecks05/08/02 12:14
RE: simpler: generating external CSS with php.ShellyMac03/19/02 14:44
how to implement this?Kassim Kasmani03/05/02 16:33
Browser detection CSS IE6Michael Hitchcock02/07/02 14:14
Has anyone actually gotten this to work?Brett02/04/02 17:23
Wish this would actually workBrett Farrey01/16/02 12:34
how can I create a .css file and a linkage?louis01/10/02 22:03
Browser detection for OperaHarry Oosterveen01/09/02 06:07
RE: The (in)famous CSS trickChance Warner01/07/02 19:17
RE: The (in)famous CSS trickJonas aka Hemlige Arne11/09/01 05:10
Browserswitchpippphilipp10/01/01 13:30
Implementationruusvuu10/01/01 09:47
RE: Sniffer codeMark09/28/01 08:26
Sniffer codeLoki09/12/01 03:39
RE: Form fieldskutte09/11/01 02:01
RE: My own PHP browser detectionToma08/30/01 08:39
CSS PositionThomas08/17/01 11:33
RE: Netscape and style-classesJoel Sanda08/03/01 22:57
How to check about bit-encription of browser?prinya07/26/01 20:27
How to check bit encription of browser?Pim07/26/01 20:10
RE: Netscape and style-classesalex07/19/01 05:02
Netscape and linked CSS's the answer!!noboby important07/10/01 06:48
Help PleaseAnthony P Bikowski07/08/01 13:55
What is formal specification TechniquesPujari Pandit07/06/01 07:19
xx-small and TEXTAREAHenrik Erlandsson07/04/01 09:18
Netscape and style-classesErx06/24/01 12:57
RE: Can Anyone Know how to do this?Just Some Guy06/23/01 20:46
RE: simpler: generating external CSS with php.Eric Blade05/30/01 00:20
Can Anyone Know how to do this?GamerZ05/28/01 00:13
RE: Forget all that code *sheesh* do thisDan05/25/01 00:55
RE: simpler: generating external CSS with php.Servo05/23/01 13:22
RE: Use pixels in CSSServo05/23/01 13:05
RE: Forget all that code *sheesh* do thisServo05/23/01 12:52
RE: Forget all that code *sheesh* do thistenacious04/20/01 02:21
Opening new windowC. Dick04/13/01 17:51
Neater way for the final stepDave04/10/01 05:17
RE: Mozilla?FlyHigh04/02/01 14:01
RE: simpler: generating external CSS with php.FlyHigh04/02/01 13:55
RE: Mozilla?Eric Blade03/26/01 13:14
RE: simpler: generating external CSS with php.Eric Blade03/26/01 13:08
simpler: generating external CSS with php.Ben Hardy03/12/01 14:52
Forget all that code *sheesh* do thisMike Webby03/11/01 18:21
yikes, my bad (was: other options)adam02/17/01 19:50
RE: How get the client screen size?Colin Bell02/03/01 07:39
How to position multiple layers?aumbrother01/27/01 16:21
other options...adam01/21/01 07:28
RE: Using it to link external style sheetsMichael Svazas01/19/01 20:22
The (in)famous CSS trickSimen Brekken01/11/01 04:55
RE: Won't work, no matter whatDonny01/09/01 18:32
RE: How get the client screen size?Liam DelaHunty01/06/01 16:48
How get the client screen size?Farrukh Shahzad12/26/00 09:45
RE: My own PHP browser detectionRick Allen12/06/00 16:56
Won't work, no matter whatRick Allen12/05/00 17:17
RE: Using it to link external style sheetsAndrew11/27/00 21:56
PHPClientSnifferRoger Raymond11/03/00 16:03
RE: Mozilla?Joseph M. Ferris10/24/00 18:33
RE: My own PHP browser detectionNeil P Davis10/19/00 08:44
RE: version returs 0 and agent returns OTHERNeil P Davis10/19/00 08:40
RE: Browsers so poorly with CSSNeil P Davis10/18/00 15:47
RE: Code breaks on resizing window in NetscapeSean Wilson10/15/00 19:37
javascript:history.back()Philip10/09/00 01:20
Code breaks on resizing window in NetscapeJeanie MacWilliam10/04/00 16:27
RE: Browsers so poorly with CSSKyle Donaldson09/27/00 11:23
RE: version returs 0 and agent returns OTHERKyle Donaldson09/26/00 19:31
YABC- yet another browser checker :)dbrossa09/11/00 16:12
RE: Why css_site()?philip olson09/11/00 12:00
Why css_site()?Anders Mejner09/09/00 14:49
Windows BrowsersJames08/30/00 16:01
version returs 0 and agent returns OTHERDanny Appaiah.M.M08/30/00 02:01
My own PHP browser detectionAlex Lee08/30/00 00:42
RE: Mozilla?Alex Lee08/30/00 00:37
Use pixels in CSSVladimir Rüntü08/29/00 05:13
RE: Using it to link external style sheetsJeremy Rempel08/27/00 21:49
RE: Form fieldsDELCAMPE Sébastien08/27/00 03:26
Using it to link external style sheetsEvert Smit08/25/00 04:26
RE: AwesomeBrett Stimmerman08/25/00 01:20
RE: AwesomeAmaury Jacquot08/24/00 23:55
RE: Mozilla?Richard Heyes08/24/00 15:10
mozilla vs. netscape renderingTodd Hammer08/24/00 13:54
RE: Need AssistanceWolfgang Drews08/24/00 08:58
RE: Form fieldsPeter Huestis08/24/00 07:31
Form fieldsDELCAMPE Sébastien08/24/00 02:12
RE: Mozilla?philip olson08/23/00 20:28
Mozilla?Neil Moomey08/23/00 20:10
RE: Browsers so poorly with CSSPeter Huestis08/23/00 17:57
Browsers so poorly with CSSRyan McGeary08/23/00 17:05
RE: Awesomejim08/23/00 04:42
Need AssistanceChris Carroll08/23/00 02:18
RE: AwesomeRichard Heyes08/22/00 13:53
AwesomeBrett Stimmerman08/22/00 02:40
RE: Why not get_browser() ?Peter Huestis08/21/00 12:50
get_browser..Chad Day08/21/00 10:49
RE: Why not get_browser() ?Tim Perdue, PHPBuilder.com08/21/00 10:34
Why not get_browser() ?Jens-Petter Salvesen08/21/00 10:18
Getting this Implemented Now...Peter Huestis08/21/00 09:13
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.