JavaScript window location href property enables you to get or set the current URL location of the web browser. You can get the current URL location by accessing the href property of location object. If you will set value of href property of location as a new URL location then it will redirect the current page to new location. JavaScript location object belongs to JavaScript window object that allows you to access the href property using window.location.href. You can also access the href property directly as location.href.
Try the sample below to learn and practice the code functionality of JavaScript window location href property: