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:


Example: using Location origin property in JavaScript

const value = location.origin;


Leave a Reply