Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

absolute vs. relative links?

When creating links for an an html based email, how critical is it to use absolute links? Also, What are the benefits in using relative links in general?

like image 211
rashneon Avatar asked Dec 05 '08 02:12

rashneon


People also ask

What is the difference between an absolute and relative link?

An absolute URL contains all the information necessary to locate a resource. A relative URL locates a resource using an absolute URL as a starting point. In effect, the "complete URL" of the target is specified by concatenating the absolute and relative URLs.

Should I use relative or absolute links?

An absolute URL contains more information than a relative URL does. Relative URLs are more convenient because they are shorter and often more portable. However, you can use them only to reference links on the same server as the page that contains them.

What is the difference between an absolute and a relative link within an image tag?

The difference between an absolute URL and a relative URL is that absolute URLs are the entire URL and relative URLs are only a portion of the URL. Examples: Absolute: <img src "http://www.yourdomain.org/images/picture.gif">

Which is an example of a relative link?

For instance, a relative link from a page in Folder 1 to a page in Folder 2 would be ../Folder 2/page. html, where the ../ tells the browser you want to go out of the current folder and into a new one.


1 Answers

Relative links allow you use less code to traverse your structure, and they allow you to move domains without having to do any extra work. You simply copy your directory structure to the new domain, and it works.

As a lesser consideration, Absolute links don't make you worry about the position of your document relative to other documents -- which while not 'hard' to overcome, it adds an extra layer of thought that you have to be cognizant of.

Luckily the Holy War isn't as big as other programming holy wars.

For Email, your only real choice are absolute links.

like image 100
George Stocker Avatar answered Oct 12 '22 03:10

George Stocker