'Netscape style.css recursion' & Zope - Gotcha
Hullo! I'm sure this will be obvious to some, but it took me the best part of a morning to figure out so I thought i'd post it anyway... I had a problem with Netscape (on linux) going into an infinite loop looking for a stylesheet when retrieving a non-existent url from zope. Here's why: Imagine serving up a page on http://127.0.0.1:8080/foo/bar <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <p> This is the index_html Document. </p> </body> </html> split up into standard_header_html and standard_footer_html as expected. Now visit a non-existent url eg http://127.0.0.1:8080/fu/bar Zope now serves up standard_error_message eg <dtml-var standard_header_html> oh dear, an error has occurred... <dtml-var standard_footer_html> This causes Netscape to retrieve http://127.0.0.1:8080/fu/bar/style.css which of course it can't find, so it tries again, and again.... (_duh_) So the moral of this story: - In line you style sheets? - use an absolute link to style.css not a relative one? - have a more independent standard_error_message page? - get Zope to redirect to a standard error page rather than inherit it? Hope someone finds this useful! regards, Chris.
On Tue, 31 Jul 2001, Chris Hinds wrote:
This causes Netscape to retrieve http://127.0.0.1:8080/fu/bar/style.css which of course it can't find, so it tries again, and again.... (_duh_)
IE doesn't exhibit this behavior -- it doesn't find the style sheet, of course, but it doesn't hang in recursion.
So the moral of this story: - In line you style sheets?
... which makes your user download your CSS w/everypage. Very non-optimal.
- use an absolute link to style.css not a relative one?
... which makes it difficult to use cool Zope tricks, such as having style.css in a folder that overrides the styles for particular parts of a site. Of course, using just a relative link means that your users browser has to request /site/foo/style.css, /site/bar/style.css, /site/baz/style.css (due to inheritance), and the browser won't be able to use a cached copy much of the time anyway, because it appears to be a different css sheet.
- have a more independent standard_error_message page? - get Zope to redirect to a standard error page rather than inherit it?
Why not: <link rel="stylesheet" type="text/css" href="<dtml-var style.css url>"> This way, you get the benefit of inheritance (you can override style.css in a folder), Zope always returns the same URL for the same css file, so caching can work, and if finds the correct file when there is an error. (http://site/no/such/dir) still shows CSS, so the Netscape recursion problem should go away. -- Joel Burton <jburton@scw.org> Director of Information Systems, Support Center of Washington
participants (3)
-
Chris Hinds -
Joel Burton -
Toby Dickenson