Location: protocol

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


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


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


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

Browser compatibility

BCD tables only load in the browser