Fri, 09 May 2003
Why does AmphetaFrames look rubbish in Mozilla/Phoenix/Galeon? (FAQs)
This is a known problem to do with the way Mozilla requires a web server to send stylesheets to it with a MIME type of "text/css".
In the current production version of AmphetaDesk (0.93.1), the AD web server only distinguishes between document types of "image" (gif/jpg/png), which it serves up as the relevant image type, and "everything else", which it serves up as "text/html". Morbus made a small patch to this section of code back back in November, but he hasn't released any new production versions since then, so the patch hasn't made it through into current code.
If you're comfortable going into the AmphetaDesk files and changing a bit yourself, here's what you need to do:
- In the Amphetadesk directory, open up the file lib/AmphetaDesk.pm
- Look for the following section (at around line 238):
# if the filename exists, pass it
# through AmphetaDesk::Templates.
elsif (-e $filename) {
# print out the http headers. $connection->send_basic_header();
$connection->print("Content-Type: text/html\015\012");
$connection->print("\015\012"); # no more headers.
# fill it in, and then send it out. fun, fun.
# parse_template is located in AmphetaDesk::Templates.
$connection->print( parse_template($filename) ); }
- Replace this section with:
# if the filename exists, pass it
# through AmphetaDesk::Templates.
elsif (-e $filename) {
# determine our correct mime-type.
my $type = "text/plain"; # default to plain.
if ($filename =~ /html?$/) { $type = "text/html"; }
elsif ($filename =~ /css$/) { $type = "text/css"; }
# print out the http headers. $connection->send_basic_header();
$connection->print("Content-Type: $type\015\012");
$connection->print("\015\012"); # no more headers.
# fill it in, and then send it out. fun, fun.
# parse_template is located in AmphetaDesk::Templates.
$connection->print( parse_template($filename) ); }
- Stop and re-start AmphetaDesk.
This will tell the AmphetaDesk engine to serve up CSS files with the proper "text/css" MIME type.
Some further reading:
Comments & Trackbacks
Useful fix for a useful template. Thank you! I'm loving AmphetaFrames so far.
Note: The line that reads,
# print out the http headers. $connection->send_basic_header();
should be on two lines... it borked everything on mine until I added a newline in the right place. ;-)