homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

img src anomaly
using ../ in public_html

 3:53 am on Nov 20, 2010 (gmt 0)


I came upon something curious today. The following code is in a file in a public_html folder. I expected the first paragraph to display a broken image, but both images showed fine. I checked in three browsers.

The only thing I could come up with is that the browsers are ignoring the ../ in the first paragraph since the file is already in web root.

I tried to Google it to see if it was documented, but could find nothing. I could swear I've accidentally added a ../ to an img src in a public_html file before and got a broken image.

<p><img src="../assets/images/image-2.jpg" width="300" height="194" alt="" /></p>

<p><img src="assets/images/image-2.jpg" width="300" height="194" alt="" /></p>

Is this something I have just never noticed before? Or am I missing something? :-)




 6:02 am on Nov 20, 2010 (gmt 0)

you just haven't noticed it before.

../assets and assets are equivalent paths


 7:27 am on Nov 20, 2010 (gmt 0)

Thank you.

Am I right in assuming you meant "...are equivalent paths if the code is used in the web root."

ie. if you are in some subfolder then ../assets/ and assets/ would definitely not be the same thing.

I can't believe I've never noticed that.

Still Learning! :-)


 5:28 pm on Nov 20, 2010 (gmt 0)

if the code is used in the web root

yes, exactly so.


 8:49 pm on Nov 20, 2010 (gmt 0)

Thank You!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved