|
Posted by Rik Wasmus on February 25, 2008, 12:07 pm
Please log in for more thread options
> Thanks Rik.
>
> Well, I think the idea is to use "relative paths".
Well, duh.
> The browser is an
> application that will be loaded on several servers at various
> locations so, its better to do something like "../path/to/image.jpg"
> than use a URL or and IP which changes from box to box.
Yes, but if a page is http://project.example.com/index.html, having a =
relative URL like '../images/foo.jpg' doesn't do you any good, as =
allthough it may seem a valid path on the server, a browser doesn't =
request relative urls from the server, it translates them and uses a ful=
ly =
qualified url. In the example, there is no path above =
http://project.example.com... Would you have had =
http://www.example.com/foo/bar.html, with a src attribute like =
'../images/foz.jpg', the browser requests =
'http://www.example.com/images/foz.jpg', NOT '../images/foz.jpg'.
>> What's the URL of the actual page you are watching?
>
> So, havening said that, the URL (not public) is =
> http://www.domain.com/presentation.aspx
example.com is reserved for those purposes. Here, from s browsers point =
of =
view, there is clearly no path above it.
> And, inside presentation.aspx is an iframe that has src=3Dslides.htm.
> Inside slides.html is the image tag that looks for an image in a
> sibling folder to the root folder.
>
>> url should be a valid 'path' considered from the browsers point of =
>> view, NOT the servers.
>
> I think I am doing that correctly. And, as far as i understand, the
> below image:
>
> <img src=3D"../folder/image.jpg" alt=3D"img" />
>
> should expose an image in a folder named "folder" that is a sibling to=
> the web site's root folder.
Nope, you can't go outside the root folder (you can offcourse serve file=
s =
outside the root folder using some scripts on the server, that's beside =
=
the point though), the browser MUST have a 'reachable' destination. The =
=
browser doesn't know lick about your filesystem, and can't examine it. =
Having the path 'http://www.example.com/', there's no logical way a =
browser can select a directory above that, or even guess at how to acces=
s =
it.
-- =
Rik Wasmus
|