Should I use window.navigate or document.location in JavaScript?

dthrasher picture dthrasher · Jun 4, 2009 · Viewed 207.7k times · Source

What's the preferred method to use to change the location of the current web page using JavaScript? I've seen both window.navigate and document.location used. Are there any differences in behavior? Are there differences in browser implementations?

Answer

James Skidmore picture James Skidmore · Jun 4, 2009
window.location.href = 'URL';

is the standard implementation for changing the current window's location.