Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

    Question How does web servers serve Media with relative path?

    Hello

    I have been trying to find an answer to this for long but no dice so finally posting it here hoping someone can help me understand the concept.

    Consider the following HTML code:

    Code:
    <!--index.html-->
    <html>
    <head>
    <title>Welcome</title>
    </head>
    <body>
    <img src="images/banner.png" />
    </body>
    </html>
    The Scenario:
    Suppose I have an apache web server running on a machine and the web root folder has the above index.html as well as the banner.png image sitting under the "images" directory under web root. A user requests the page from a remote location using the server's domain http://phantom007.com, the user's browser will render the html page along with the image.

    Now the question(s).
    Since the image source in the above index.html file has a relative path (images/banner.png) and not an absolute path (http://phantom007.com/images/banner.png), then:

    1) How does the user's browser render the image that has a relative path in a remote location?
    2) Does the image file also gets transferred to the client's machine?
    3) If the answer to the above is "yes", in which medium / format does it get transferred? I mean via the headers or something else?



    Thanks for any inputs.

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,313
    Thanks
    4
    Thanked 206 Times in 203 Posts
    Quote Originally Posted by phantom007 View Post
    1) How does the user's browser render the image that has a relative path in a remote location?
    A browser simply requests an image from a server. Once delivered the browser renders it.

    Quote Originally Posted by phantom007 View Post
    2) Does the image file also gets transferred to the client's machine?
    It always does. It has to. There is no other way for the browser to display it.

    Quote Originally Posted by phantom007 View Post
    3) If the answer to the above is "yes", in which medium / format does it get transferred? I mean via the headers or something else?
    It's a data stream with appropriate headers to indicate what is coming to the browser (an image in this case).
    Dave .... HostMonster for all of your hosting needs


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •