From: Peter Seidel Date: 2006-09-12T17:09:54+09:00 Subject: cgi scripts and external css Consider this CGI script: #!ruby require "cgi" cgi = CGI.new("html4") cgi.out { CGI.pretty( cgi.html { cgi.head { cgi.title{"Example"}+"" } + cgi.body{"This should have a green background"} } ) } with this example.css, both residing in the same directory: body { background-color: #00ff00; } it produces this html output: Example This should have a green background Perfectly fine, it seems. The only problem is, that the background isn't green, it's white (Firefox' default color, on my system). However, if I save the html-source to a static example.html, put in the same directory as my example.rb and open it in the browser, the css is correctly applied and the background turns green. It works if I put the css directly in the example.rb like this: #!ruby require "cgi" cgi = CGI.new("html4") cgi.out { CGI.pretty( cgi.html { cgi.head {cgi.title{"Example"}+ cgi.style('type'=>'text/css'){File.read("./example.css")}} + cgi.body{"This should have a green background"} } ) } But this way the css is not cacheable... Where lies the problem in my script? (FYI I use ruby 1.8.2 (2004-12-25) [i386-mswin32], Apache and Windows XP Pro) -- Posted via http://www.ruby-forum.com/.