Dave's Brain

Browse - programming tips - javascript get current url

Date: 2009dec28
Level: beginner
Language: javaScript

Q.  How can I get the current URL?

A.  Access the href member of the location object like this:

	function displayCurrentUrl() {
		alert('Current URL is ' + location.href);
	}
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2010, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.