Get the current URL with JavaScript?

All I want is to get the website URL. Not the URL as taken from a link. On the page loading I need to be able to grab the full, current URL of the website and set it as a variable to do with as I please.

Text Copied From stackoverflow.com
on : Tue, Jun 23, 2009 Views : 2240512

Accepted Answer

Use:

window.location.href  

As noted in the comments, the line below works, but it is bugged for Firefox.

document.URL;
 

See URL of type DOMString, readonly.

Text Copied From stackoverflow.com
on : Tue, Jun 23, 2009

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp