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

2 Comments

Comments have been disabled for this content.