JavaScript Tutorial in Hindi for Beginners [Part 68] - Location object in JavaScript

Tech Gun
Youtube
Related Topic
:- Web Development Javascript

 In this video i will talk about Location object in JavaScript. The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page. The window.location object can be written without the window prefix. Some examples: window.location.href returns the href (URL) of the current page window.location.hostname returns the domain name of the web host window.location.pathname returns the path and filename of the current page window.location.protocol returns the web protocol used (http: or https:) window.location.assign() loads a new document The assign() method accepts an URL, navigate to the URL immediately, and make an entry in the browser’s history stack. The replace() method is similar to the assign() method except it doesn’t create a new entry in the browser’s history stack. 

Comments