Location: protocol

The protocol property of the Location interface is a USVString representing the protocol scheme of the URL, including the final ':'.

Syntax

string = object.protocol;
object.protocol = string;

Examples

// Let's an <a id="myAnchor" href="https://developer.mozilla.org/Location.protocol"> element be in the document
var anchor = document.getElementById("myAnchor");
var result = anchor.protocol; // Returns:'https:'

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'protocol' in that specification.
Living Standard Initial definition.

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
protocolChrome Full support YesEdge Full support 12Firefox Full support 22IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 22Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support
Full support