The protocol property represents the protocol being used in the current Web browser.
This is the first piece of text in the URL.
<html>
<head>
<title> Using the protocol property of the Link object</title>
</head>
<body>
<script language="JavaScript">
<!--
function showproto(){
alert(document.links[0].protocol);
}
-->
</script>
Click the button to see the protocol used for the URL
<form name="form1">
<a href=http://www.java2s.com>
http://www.java2s.com</a>
<br><br>
<input type="button" name="proto" value="Get Protocol" onClick='showproto()'>
<br>
</form>
</body>
</html>