JavaScript Location href Tutorial

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

JavaScript Location href Property

The `href` property is used to set or return the fully qualified URL of the currently loaded page.

Location href Property Syntax:


Example: JavaScript Window Location href

See the Pen JavaScript Window Location href by Omid Dehghan (@odchan1) on CodePen.


If we click on the button on the page, we will be directed to the homepage of this website

Leave a Reply