1
2
<html>
3
<body>
4
<h1>Getting the current URL in JavaScript</h1>
5
<p id="protocol">URL will display here<p>
6
<script>
7
let protocol = document.getElementById('protocol');
8
protocol.innerHTML = "The page protocol is: <b>" + window.location.protocol + "</b>";
9
</script>
10
</body>
11
</html>
Getting the current URL in JavaScript
The page protocol is: https: