how to get the url of a web page location.search code example Example: get actual url in variable var currentLocation = window.location;