Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Absolute (full) URLs without "http:" in HTML href

I have been seeing this a lot lately and I am unable to find any information on it.

Is there a name for it?
Which browsers support this?

like image 909
Xen Avatar asked Jun 14 '12 15:06

Xen


People also ask

How do you create an absolute URL in HTML?

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

How do I give a href a relative URL?

To link pages using relative URL in HTML, use the <a> tag with href attribute. Relative URL is used to add a link to a page on the website. For example, /contact, /about_team, etc.

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).

Is absolute URL better than relative?

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.


Video Answer


1 Answers

It's the same as an absolute URL except that the schema will be the one used for the base URL. Thus, if you say //mysite.com/images/img.png on an https page, the image will be loaded with https and on an "ordinary" http page it will be loaded using the http schema (and, respectively, different default ports.)

This approach lets avoid the security warnings from browsers in the case when you have insecure content loaded by secure pages (and the pages can be loaded using both http and https protocols).

like image 53
Alexander Pavlov Avatar answered Nov 14 '22 11:11

Alexander Pavlov