- By Guy Lecky-Thompson,
- Forward from http://www.suite101.com/content/how-to-get-url-parts-in-javascript-a48335
This JavaScript tutorial article concentrates on:
- Obtaining the URL from the window.location object
- Changing the current location with window.location.href and window.location.reload
- Splitting and rebuilding URLs with Array and String splitting functions
The first step is understanding the JavaScript Location object.
The Location Object
This is a JavaScript class that is used to store URLs. It comes with properties that represent each part of the URL, and can be updated by changing the href property. The key properties that this article deals with are: