JavaScript Location protocol Tutorial

In this section, we will learn what the location protocol property is and how to use it in JavaScript.

JavaScript Location protocol Property

The `protocol` property is used to set or get the protocol that is used in the URL of the currently loaded document.

Location protocol Property Syntax:

location.protocol;

Example: using Location protocol property in JavaScript

const value = location.protocol;

console.log(value);

Output:

https:
Facebook
Twitter
Pinterest
LinkedIn

Top Technologies