Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
110
rated 0 times [  114] [ 4]  / answers: 1 / hits: 23887  / 15 Years ago, mon, june 22, 2009, 12:00:00

Possible Duplicate:

Get current URL with JavaScript?






How do you get the address of the page you are on in JavaScript?



For example, if I had a script at somesite.com/javascript/home.html and I want to find out the request address (somesite.com/javascript/home.html), how do I get this information in JavaScript?


More From » javascript

 Answers
41

You need to use:
document.location or window.location



You can read more here. Or there is a little more explanation over there.



For clarifying matter:



Originally Posted by Mozilla Developer Center




document.location was originally a
read-only property, although Gecko
browsers allow you to assign to it as
well. For cross-browser safety, use
window.location instead.



[#99265] Wednesday, June 17, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaceyr

Total Points: 510
Total Questions: 97
Total Answers: 116

Location: Solomon Islands
Member since Fri, Oct 8, 2021
3 Years ago
kaceyr questions
;