Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone, I am having trouble displaying images only using the firefox browser. Apache 1.3 is the webserver running on localhost + Windows XP + ActivePerl 5.8. I am using the following code, but have tried many alternatives.

print <<HTML;

<html><head><title>My Program</title></head>

<body bgcolor="#FFFFFF" text="#000000">

<img src="file:///C:/Sunset.jpg

</body></html>

HTML
This will work fine when I access the script using Internet Explore 6 (eg http://localhost/cgi-bin/myscript.pl , but when accessed from firefox the image is not displayed. I have typed the image location into the browsers which successfully display the image.
Any ideas/Suggestions? Thank you

Replies are listed 'Best First'.
Re: Image display firefox problem
by davido (Cardinal) on Jun 19, 2005 at 05:14 UTC

    You're missing a "> after Sunset.jpg ...not sure why IE wouldn't care about that.

    Another possibility might be to try clearing Firefox's cache and restarting it.


    Dave

Re: Image display firefox problem
by polettix (Vicar) on Jun 19, 2005 at 10:11 UTC
    You can use a HTML Validator to be sure that you're not missing trivial formatting errors in your HTML.

    BTW, are you the same of this node?

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
Re: Image display firefox problem
by Joost (Canon) on Jun 19, 2005 at 11:14 UTC
Re: Image display firefox problem
by cajun (Chaplain) on Jun 19, 2005 at 06:58 UTC
    In addition to what davido said, press <shift> then click reload in your browser.
Re: Image display firefox problem
by bmann (Priest) on Jun 19, 2005 at 16:48 UTC
    The solution is to put the image inside your webroot and request it via http. Firefox will not open a local file requested from a remote site for security reasons (Even though apache is running at localhost, firefox considers it "remote").

    Details are here: http://kb.mozillazine.org/Firefox_:_Issues_:_Links_to_Local_Pages_Don't_Work, along with their reasoning. There is also a workaround, if you still feel you need it.

Re: Image display firefox problem
by cees (Curate) on Jun 19, 2005 at 13:32 UTC

    UPDATE: Looks like I was wrong here. Randal's got it right

    You have one too many slashes in your URL. The proper schema should be file://, and you have file:///. Now on unix machines, it always looks like there are three slashes in a row, because file URLs are usually absolute, hence you have the extra / for the root directory. Try the following instead:

    <img src="file://C:/Sunset.jpg" />