Welcome to WebmasterWorld Guest from 54.226.27.104

Forum Moderators: incrediBILL

Message Too Old, No Replies

img src anomaly

using ../ in public_html

     

Kallym

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

5+ Year Member



Hi,

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? :-)

Thanks!

topr8

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

WebmasterWorld Senior Member topr8 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



you just haven't noticed it before.

../assets and assets are equivalent paths

Kallym

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

5+ Year Member



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! :-)

tedster

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

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



if the code is used in the web root

yes, exactly so.

Kallym

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

5+ Year Member



Thank You!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month