The location property of a window is a reference to a Location object which represents the current URL of the document being displayed in that window. Since window object is…