JavaScript window.location.port Property
JavaScript window.location.port Property
The window.location.port
property returns a string containing the port number of the current page.
Note: If the URL does not contain an explicit port number, it will be set to ''
. For example, wikimass.com is running in port 80 (http port) which is default for any website, so port number will not be displayed for port 80 as it doest not contain any explicit port.
The following table lists common ports and their security modes:
Protocol | No encryption Plain port | TLS/SSL Explicit port | TLS/SSL Implicit port |
---|---|---|---|
FTP | 21 | 21 | 990 |
SMTP | 25 or 587 | 25 or 587 | 993 |
IMAP | 143 | 143 | 993 |
POP3 | 110 | 110 | 995 |
Telnet | 23 | 23 | 992 |
HTTP | 80 | - | 443 |
Example
Syntax
Return Value
Value | Explanation |
---|---|
String | Returns a string containing the port number of the current page. |
More Examples
Example
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.