You can get the document.URL, but you can not set it.
You can both get and set the location.href
.
In some webbrowsers, you are able to set the document.URL
but please don't, as it doesn't work in most browsers.
You gave the answer yourself!
var currentURL = document.URL;
alert(currentURL);
Learn more here
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…