use location.href instead of document.URL

#1154