Window location.protocol
Description
The protocol property sets or returns the protocol of the current URL, including the colon (:).
The protocol is a standard that specifies how data are transmitted between computers.
Syntax
Return the protocol property:
location.protocol
Set the protocol property:
location.protocol = protocol
Property Value
Parameter | Description |
protocol |
The protocol of the URL. Examples:
|
Return Value
Type | Description |
A string | The protocol of the current URL, including the colon (:) |
Browser Support
location.protocol
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |