6

Probably a stupid question, but is there a Javascript method to browse another url, from the existing window, not window.open() that would open another window

So something that edit the window.document.URL (possible) and refresh? not sure its possible client-side

4 Answers4

13
window.location.href = "http://example.com";
archil
  • 39,013
  • 7
  • 65
  • 82
12

You can use

window.location="http://www.dignaj.com";

You can also use navigate like this (only works in some IE)

window.navigate("http://www.dignaj.com");
Neithan Max
  • 11,004
  • 5
  • 40
  • 58
Kishore Kumar
  • 12,675
  • 27
  • 97
  • 154
2
window.location = "http://stackoverflow.com/"

Or:

window.location.href = "http://stackoverflow.com/"

If you want to refresh you can use the method reload:

window.location.reload(true);

For more details:

https://developer.mozilla.org/en/DOM/window.location

ZER0
  • 24,846
  • 5
  • 51
  • 54
0

I think this is what you're looking for:

window.location.replace('http://www.google.ch')
j_freyre
  • 4,623
  • 2
  • 30
  • 47