Why The Images displayed in IE but not in FireFox ?

I noticed there is a lot of articles that is specified an incorrect images path that only works in IE , those articles used the backslash ("\") character in the Images paths , note that using backslash in the images URL is incorrect ! instead we must use the slash ("/") , for example

this image will not be recognized by Firefox :

<img src='\images\left.gif'  ....

instead it must be 

<img src='/images/left.gif'  ....

what about asp:Image ?

if you used the backslash in the asp image control , the run time will change it to slash  if and only if you used a relative image path , for example

 <asp:Image ID="Image1" runat="server" ImageUrl="~\images\left.gif" />

will be rendered as

<img id="Image1" src="images/left.gif" style="border-width:0px;" />

Of course the same rule applies when specifying the image URL in the style sheets , for example when settings the Background-image attribute ,

background-image:url(images/left.gif);  

 

Hope it Helps

Anas Ghanem

Published Sunday, July 13, 2008 1:00 AM by anas
Filed under:

Comments

# re: Why The Images displayed in IE but not in FireFox ?

Saturday, July 12, 2008 9:00 PM by Dave Transom

Anas, really, any url needs to use forward slashes (/) as path separators.

The backslash (\) is a Windows only path separator and typically reserved for file system paths, not url's.

Leave a Comment

(required) 
(required) 
(optional)
(required)