Forum Moderators: open
If you had the full url as your image source, your visitor would get a warning that not all items on this page are secure - because they'd be http:// not https:// That means no lock icon - it's enough to send many folks running away. Using a relative url keeps that from happening, since it pulls that from the parent document.
LisaB
Or you can use the following shorthand:
../ means "go up to the parent directory"
.../ means "go up two parent directories"
..../ means "go up three parent directories"
etc
"./" = Go back 1 depth to the directory
"../" = Go back 2 depth to the directory
Thats how far I get upto, never hear of ".../"s though.
Sid
I've been living with problems like that from M$ since Windows3.x and C5.1 I stopped updating their development stuff, unless I had to because of new features I needed to make money on, because I got tired and it got to be too much money rewriting everything all the time. Some of the time, I had already put in fixes and would have to go back and take the fixes out to make it work with the new dev. stuff.
Take it from me when it comes to M$ dev. stuff. If it isn't broke, don't get an update just because it is the latest.
Assume a directory structure like this:
root
--+ public_html
--¦--+ vehicles
--¦--¦-- small_cars
--¦--¦-- trucks
--¦--¦-- motorcycles
--¦--+ food
--¦--¦-- fast_food
--¦--¦-- gourmet
In the following webpage:
http://mydomain.com/food/gourmet/index.html
I'd link to the following image:
http://mydomain.com/vehicles/small_cars/escort.gif
Using the following code:
<img src="/vehicles/small_cars/escort.gif" width="100" height="40" alt="Ford Escort">
No dots or anything; just the backslash. It's always worked for me; but is there a reason I should use the ../ method?
No dots or anything; just the backslash. It's always worked for me; but is there a reason I should use the ../ method?Two reasons that I can think of:
When testing the file locally, if the local file was c:\mysite\small_cars\escort.gif, it not work with /vehicles/small_cars/escort.gif but it would with ../vehicles/small_cars/escort.gif.
If you should ever move /vehicles and /food directies under an /items folder, you wouldn't have to go fixing all those links in all the html files.
Though I've never used it, I think you can get around these limitations also with the base tag.
So pages that are linked to with only ../ might not get indexed.
The reason people use ../ is for development the url could be dev.devdomain.com and production would be www.brandname.com, using ../ relaive url's allows moving the site without a code change.
For the last several years though the accepted norm is to create an application level variable that holds the base url.
So in ms land in global.asa you would have an app var called baseURL="dev.devdomain.com" or baseURL="www.brandname.com".
This is used in code as <img scr="<%=Server.ApplicationVars("baseURL")%>">
No dots or anything; just the backslash. It's always worked for me; but is there a reason I should use the ../ method?
The "../" means go up one directory
The "/" means go to the ROOT directory.
Thus "/example1/example2/example.htm" would translate to "http://www.example.com/example1/example2/example.htm"
While "../example.htm" would translate to "http://www.example.com/example.htm" if example.htm were contained in the "example1" directory, and it would translate to "http://www.example.com/example1/example.htm" if it were in the example2 directory.