JavaScript Location origin Tutorial

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

JavaScript Location origin Property

The origin property checks a URL and returns its “protocol”, “hostname”, and its port number.

Note: this method is read only.

Location origin Property Syntax:

location.origin

Example: using Location origin property in JavaScript

const value = location.origin;

console.log(value);

Leave a Reply