Как насчет этого?
function getUrl() {
var location = document.location.href,
locationLength = location.length,
hash = document.location.hash;
if (hash
&& location.substring(locationLength - 1, locationLength) == '#') {
location += hash;
}
return location;
}
jsFiddle .
Они возвращают то же самое в Firefox 3.6.13 и Chrome 9.
Хотя я всегда использовал window.location
.