<html>
<body>
<h2>JavaScript</h2>
<p id="demo"></p>
<p><b>Note: </b>If the port number is default (80 for http and 443 for https), most browsers will display 0 or nothing.</p>
<script>
document.getElementById("demo").innerHTML =
"The URL port number of the current page is: " + window.location.port;
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_loc_port by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:03:06 GMT -->
</html>