This week's book giveaway is in the Testing forum.
We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes location, location.href Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "location, location.href" Watch "location, location.href" New topic
Author

location, location.href

Mike Yu
Ranch Hand

Joined: Nov 17, 2001
Posts: 175
Hi,
if javascript, what is the difference between location= url and location.href=url. Here url represents a web page.


Thanks,<br />Mike
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
location is a bad way to reference the location object. Most browsers will act like the href is there.
there is more then href that can go after location
there is replace
hash
host
hostname
reload
and some others
so the best bet is to use the href
Eric
 
 
subject: location, location.href
 
Threads others viewed
Check and Replace Parent Page
Session Management with Ajax
How to tell navigator to redirect to another url with javascript
java
Limitation on the number of parameters passed via location.href
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture