This is G o o g l e's cache of http://www.new2html.com/help/Relative-URL.shtml.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:nQNs4ZrU-xgJ:www.new2html.com/help/Relative-URL.shtml+webtv+site:http://www.new2html.com&hl=en&ie=UTF-8


Google is not affiliated with the authors of this page nor responsible for its content.
These search terms have been highlighted: webtv 

New 2 HTML - Optimize Your WebTV
<p align="center"><font size="5" color="#ff0000"><b><B style="color:black;background-color:#ffff66">WebTV</B> JavaScript Bug Alert</b></font></p> <p align="center"><font size="5" color="#ff0000"><b>Reload Page</b></font></p> <p align="center"><font size="5" color="#ff0000"><b><u>CMD + R for 3 Seconds</u></b></font></p> <br /> <br /> <br /> <p align="center"><font face="verdana bold,arial bold,helvetica,sans-serif" color="#000000" size="4">Computer users, this site is designed by and for the <B style="color:black;background-color:#ffff66">WebTV</B>/MSNTV Internet Terminal and may not display or function as intended for you.</font></p> <font face="verdana bold,arial bold,helvetica,sans-serif" color="#000000" size="4"><br /> <img src="1x.gif" width="1" height="300" border="0" alt="spacer image" /></font>
Top Menu Image Map Sitemap Basic HTML Advanced HTML JavaScript WorkCenter TestBed Jump Box Menus Linkables Tips-n-Tricks What's New? Daily Tip


Using Relative URLs

Relative URLs should be used when linking inside your own server or account. It's proper HTML syntax; things load faster, and you use less bandwidth. It works for linking to .html pages, as well as image and audio files and when using SSI.
What you are doing is eliminating the time and effort it takes for the browser to pull a file all the way across the internet. If you use the full URL, the browser has to start all over with each image or file starting with the http://www.server.com/UserName/, but if the image is already in your account, you can eliminate all of that so your browser knows it can just stay in your account.

Note: In this display I am not showing full image attributes, (height, width etc.) but you should use them on your own pages.

If the thing you are linking to is in the same directory, or in it's subdirectory, you can just use the file name like this:

<img src=picture.gif"> or <embed src=song.mid">

To go "down" one step to the previous directory you will use 2 periods and a backslash ../

If you are building a page in a sub-directory (we will call it SUB) and you have other directories of images (called IMG) and one of midis (called MID), your page codes will be like this. For an image:

<img src="../IMG/picture.gif">For music: <embed src="../MID/song.mid">

If you are building inside a sub-directory of another sub-directory you will use the ../ for each level you need to step down.

Example, the page URL is:

http://www.server.com/UserName/SUB-1/SUB-2/Page.html

Now we will say that an image you want is in your IMG directory, the code should look like this:

<img src="../../IMG/picture.gif">

^ Proper code ^     v Improper code v

<img src="http://www.server.com/UserName/IMG/picture.gif">

If you are making the page in your main directory and want to call an image from your IMG directory, the tag will be this:

<img src="IMG/picture.gif">

Never start a relative link with a slash unless you are linking to another person's account on the same server, and an example would be like this: Say we both have a Geo account, and if I am making a page, I can link to your images by doing this:

<img src="/YourActName/IMG/picture.gif">

The above code will let me link to your account without going off Geocities - then back on Geocities again like it would if you used the full URL
http://www.geocities.com/YourActName/IMG/picture.gif By using relative URLs, the server will not consider it remote linking like we may do with "signature" pages.

red line

Using Relative URLs "out of" your account

You can use relative URLs without being in your homepage account, and you can do this by using the <base href> tag. This specifies the base URL for all relative URLs on the page. When used on a webpage, it should be placed in the <head> section, but when used in a sig, it can be placed anywhere. The tag is:

<base href="http://www.Host.com/YourAccount/">

For all images, audio, or any other included file, you can now use normal relative URLs just like we talked about before, by picking up the URL from where the base href left off.

I have seen many people use a base href tag when within their own account. This is not needed, since the browser will use this as default anyway.

I will often add the base href tag when I am helping someone with a page because I transload their page to my account to work on, then add the base href and use relative URLs to make included files show up. After I'm finished, I remove the <base href..> and transload it back into their account, and everything works as it should.

red line

Relative URLs in a Sig

I also like to use relative URLs in my sig. To do this, we will add a <base href> tag again. Just set up the sig something like this:

<html> <base href="http://driver70.tv/">
<embed src="mid/song.mid" autostart=true loop=2>
<img src="img/picture.jpg">
<iframe src="sigpage.html" width="100%">
</body>

In the above example, it would have a midi, an image, and an included html page in an iframe - all with that little code. This won't stop people from taking and linking to your images or audio, but it sure will confuse a lot of them...:›)

There is 1 visitor online



Search New2HTML.com powered by FreeFind