JavaScript document URL Property Tutorial

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

What is document URL Property in JavaScript?

The JavaScript document URL property is used to get the full URL of the document that is currently loaded on a browser window.

document URL Property Syntax:

document.URL;

document URL Property Input Value

This property is read-only and so we can assign a value to it.

document URL Method Property Value

The return value of this method is a string representation of the currently loaded document’s URL.

Example: using document URL Property in JavaScript

See the Pen using document URL Property in JavaScript by Omid Dehghan (@odchan1) on CodePen.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies