Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a simple html file. Image appears in Chrome and IE8 but does not appear in Firefox. Why ? Can anyone tell me what is wrong ? :)

XML
<html>
<head>
</head>

<body>

<img src="C:\Sunset.jpg" width="150px" height="150px" >

</body>
</html>
Posted

1 solution

Try it with a correct URL:

XML
<html>
<head>
</head>

<body>

<img src="file:///C:/Sunset.jpg" width="150px" height="150px" >

</body>
</html>


That'll do for FireFox (proven) and probably Chrome too.
A file URL has to start with schema file:/// and you should always use only forwared slashes (/) instead of backward ones (\).

Best Regards,
Manfred
 
Share this answer
 
v2
Comments
Valery Possoz 2-Jan-11 14:38pm    
You could also use relative path <img src="../Sunset.jpg" width="150px" height="150px" >

Valery.
Manfred Rudolf Bihy 2-Jan-11 15:10pm    
Thanks Valery, I forgot to point that out to OP. I even favor using relative paths over fully qualified ones as it makes it easy to try something from your local disk and then push to a web server without to much to edit (as long as your relative paths on disk are the same as on the server).
Cheers!
Close Network 2-Jan-11 15:17pm    
Thanks..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900