Skip to main content
property URL.protocol

The protocol property of the URL interface is a string that represents the protocol scheme of the URL and includes a trailing :.

Examples

Example 1

const myURL = new URL('https://example.org/foo');
console.log(myURL.protocol);  // Logs "https:"

Type

string

See

Back to top