This site is mobile accessible. Press the "Tap Here" button to use a different font-size.



Smartphone icons created by Freepik - Flaticon

JS Location

The window.location object

Note: If the port number is default (80 for http and 443 for https), most browsers will display 0 or nothing.

// detect and display port number of the page
document.getElementById("demo").innerHTML = 
"The URL port number of the current page is: " + window.location.port;