What Is An Absolute Link In Html

absolute links relative links

WHAT IS HTML?

HTML stands for HyperText Markup Language. It is used to design web pages using a markup language. HTML is the combination of Hypertext and Markup language. Hypertext defines the link between the web pages. A markup language is used to define the text document within tag which defines the structure of web pages. This language is used to annotate (make notes for the computer) text so that a machine can understand it and manipulate text accordingly. Most markup languages (e.g. HTML) are human-readable. The language uses tags to define what manipulation has to be done on the text. 

HTML is a markup language used by the browser to manipulate text, images, and other content, in order to display it in the required format. HTML was created by Tim Berners-Lee in 1991. The first-ever version of HTML was HTML 1.0, but the first standard version was HTML 2.0, published in 1999.

The HyperText Markup Language, or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets and scripting languages such as JavaScript

First developed by Tim Berners-Lee in 1990, HTML is short for Hypertext Markup Language. HTML is used to create electronic documents (called pages) that are displayed on the World Wide Web. … HTML code ensures the proper formatting of text and images for your Internet browser.

Features of HTML: 

  • It is easy to learn and easy to use.
  • It is platform-independent.
  • Images, videos, and audio can be added to a web page.
  • Hypertext can be added to the text.
  • It is a markup language.

Why learn HTML? 

  • It is a simple markup language. Its implementation is easy.
  • It is used to create a website.
  • Helps in developing fundamentals about web programming.
  • Boost professional career.

Advantages: 

  • HTML is used to build websites.
  • It is supported by all browsers.
  • It can be integrated with other languages like CSS, JavaScript, etc.

Disadvantages: 

  • HTML can only create static web pages. For dynamic web pages, other languages have to be used.
  • A large amount of code has to be written to create a simple web page.
  • The security feature is not good.

WHAT IS AN ABSOLUTE LINK IN HTML?

An absolute link is a hyperlink containing a full URL, which includes all the information needed to find a particular site, page or document or other addressable item on the Internet. This information includes: The protocol to use, such as HTTP (Hypertext Transfer Protocol) or FTP (File Transfer Protocol)

Absolute links are invariably unique. That is, for any specific copy of a document or for any specific page or directory on the Web, there exists one and only one absolute link. Within a specific domain, absolute links are not always used by page authors because once a computer has found its way to a certain domain or directory, it does not need to have that domain or directory name specified again in order to locate the sought-after item.

Links are either absolute or relative. A relative link may consist of just a file name, because relative links only have to be unique within their domain or directory. When a relative link appears on a Web page, the browser understands that the file exists in the same domain or directory as the page itself. Relative links can be faster to load because the browser doesn’t have to start from scratch to find the site and then the content.

Absolute Links

Absolute links are links that are given an exact destination. Creating an absolute link can be done with an anchor tag, or a tag. These tags require a destination which is basically where you want the user to go to upon clicking it.

Giving your anchor tag a destination is done by giving a value to the href attribute.

	
	<!DOCTYPE html>
	<html>
		<head>
			<title>Absolute Links</title>
		</head>
		<body>
			<h1>Search the web!</h1>
			<p>
				<a href="https://www.google.com">Google</a>
			</p>
		</body>
	</html>
	
This is how a link looks like.
This is how a link looks like.

In our case, since we provided a direct link to Google’s homepage, that is where clicking the link will take us.

Relative Links

Absolute links are cool, but what if you just want to link to a file in the same page/directory/folder? This is where relative links come into play.

For example, if you have two files in the same directory/folder, index.html and food.html, you can link from index.html to food.html by doing something like this:

	
	<a href="food.html">This is a link to food.html!</a>
	

Keep in mind that the value inside the href attribute does not need to be pointing to an HTML file. It can point to any file.

If you want your relative link to be relative to the root instead of the current, folder/directory, start the link off with a /.

Also important to know, if you want to make your links open a new tab, give it a target attribute with the value of _blank, like so:

	
	<a href="food.html" target="_blank">This link will open in a new tab.</a>
	

ID Links

Another popular use of the anchor tag is giving the href attribute a value of an id of another element on the page.

Clicking on this link will make your browser scroll to that element on the page. This is useful for skipping large sections of your page.

Here’s an example:

	
	<!DOCTYPE html>
	<html>
		<head>
			<title>ID Link</title>
		</head>
		<body>
			<p>
				<a href="#cereal">Click here to scroll to a good cereal.</a>
			</p>
			<p id="cereal">Corn Flakes</p>
		</body>
	</html>
	
If you make your browser window small enough vertically, you will see that it does work.
If you make your browser window small enough vertically, you will see that it does work.

How do you make an absolute link in html?

Creating an absolute link can be done with an anchor tag, or a tag. These tags require a destination which is basically where you want the user to go to upon clicking it. Giving your anchor tag a destination is done by giving a value to the href attribute

How absolute links are used in HTML?

An absolute link is a hyperlink containing a full URL, which includes all the information needed to find a particular site, page or document or other addressable item on the Internet. This information includes: The protocol to use, such as HTTP (Hypertext Transfer Protocol) or FTP (File Transfer Protocol).

If you haven’t been involved with SEO and website design, you may want to know what absolute and relative URLs are. The difference refers to the form of internal links. You basically have the choice between two options:

  1. Absolute URL: You enter the protocol, the domain address and the path of the respective directory as well as the URL name of the page, for example: https://(www.)domainadress.de/category/site.html
  2. Relative URL: They always start with a slash. So you just enter the path to the category and the page, for example: /category/page.html (relative to the web server). If the page is not assigned to a category, /page.html (relative to the document) is of course also sufficient.

As mentioned at the beginning, according to John Müller for Google it does not matter which form of internal linking you choose. This is obvious inasmuch as Google always examines the context in which internal links appear anyway. The assignment to the domain is therefore not necessary for the understanding of the link.

Although you can use both methods from an SEO perspective, you should still consider which one you choose. Because both the absolute URL and the relative URL have advantages and disadvantages.

THE ADVANTAGES OF RELATIVE URLS

  • The loading time is somewhat faster with the relative URL. However, this “something” is so minimal that it is of no further importance for the ranking.
  • Relative links can be programmed quickly and easily
  • If you move your content or put it on another server for testing, this can be done quickly and easily with relative links.

DISADVANTAGES OF RELATIVE URLS

  • Content theft (scraping) is made extremely easy with relative URLs. They can simply copy the entire page and do not even have to rewrite the internal links, since the domain was not named
  • Relative links often encourage the creation of duplicate content. If pages are moved, the relative links often lead to nothing, since the relation to the higher plane can no longer be established.
  • Search engine crawlers often have a similar problem with the relative reference. If they are always routed from one relative URL to another, you may never get to the full standard version of the domain. In the worst case, the search engine may even crawl and index pages that duplicate (such as an https and an http version). Relative links therefore always carry the risk of giving away valuable crawlbudget. Possibly unimportant pages will then be indexed while other important pages will no longer have a chance to be ranked

ADVANTAGES AND DISADVANTAGES OF ABSOLUTE URLS

When using absolute URLs, the link always points to the correct URL. The content is thus better protected against theft. If someone simply copies the content 1:1, at least the internal links still refer to your domain. The disadvantages of relative URLs described above are avoided by absolute URLs.

Disadvantages of absolute URLs are that they are not suitable for testing your site on a local or other server. If you even plan a move, the effort is much higher.

CONCLUSION

Which variant you choose should always depend on your needs. If you test a lot or know that you still want to migrate the content often, relative URLs are certainly a good choice. In terms of security, however, the absolute URLs are unbeatable.

0Shares

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *