Try window.location.href or simply location.href instead of document.location, and tell me the result.