JavaScript » Link » protocol

Syntax:
object.protocol

The protocol property is the string at the beginning of a URL, up to and including the first colon (:), which specifies the method of access to the URL.

Protocol is a property of both the Link and the Location objects and is the string at the beginning of a URL, up to and including the first colon (:), which specifies the method of access to the URL.

NOTE:
 
Although the protocol property can be set at any time, it is safer to set the href property to change a link

Examples

Code:
document.write(document.links[0].protocol)
Output:
http:
Explanation:

Assuming a link (stored in the first element of the links property) to a URL ...
 
http://home.newco.com/products/enquiries.htm#local?email=name@otherco.com
 
...this code would display the protocol property of it.