Property/Method | Description |
hash | Represents an anchor name in the URL that begins with the # character |
host | Represents the hostname and port number of the URL |
hostname | Represents the hostname part of the URL |
href | Represents the complete URL |
pathname | Represents the pathname part of the URL |
port | Represents the port part of the URL |
protocol | Represents the protocol part of the URL |
reload() | Reloads the current URL |
replace() | Loads a new Web page in the current browser |
search | The search part of the URL, including the ? |
<html> <head> <title> Creating a Location object</title> </head> <body> <form name="form1"> Click the button to get the current location value. <br><br><br> <input type="button" name="getLoc" value="Get Location" onClick='alert("The current location is: " + document.location)'> <br> </form> </body> </html>
16.1.Location | ||||
16.1.1. | Location | |||
16.1.2. | Location.assign() | |||
16.1.3. | Location.hash | |||
16.1.4. | Location.host | |||
16.1.5. | Location.hostname | |||
16.1.6. | Location.href | |||
16.1.7. | Location.pathname | |||
16.1.8. | Location.port | |||
16.1.9. | Location.protocol | |||
16.1.10. | Location.reload() to reload from cache | |||
16.1.11. | Location.reload(true) to reload from the server | |||
16.1.12. | Location.reload(false) to reload from the cache | |||
16.1.13. | Location.replace() | |||
16.1.14. | Location.search | |||
16.1.15. | Location replace in action | |||
16.1.16. | Change location.href |