views:

733

answers:

4
<input type="button" value="Back" onClick="window.navigate('http://www.google.com')"&gt;

This works on IE8, but not firefox or opera. Anyone know why and how to fix it?

+2  A: 

.navigate() only works in IE.

Try setting the window.location.

window.location.href = 'http://www.google.com'
Brandon
You should really have the .href on it.
epascarello
I've never had a problem leaving it off, but you're probably right. Updated.
Brandon
Leaving the .href out is the most compatible (cross-browser) way to navigate to another URL. window.location.href doesn't work in FF 1.5, but window.location does.
Philippe Leybaert
+5  A: 

If you check the documentation for that method, you will see the quite common:

There is no public standard that applies to this method.

This means that it's a non-standard feature that most likely only works in Internet Explorer.

This will work:

<input type="button" value="Back" onclick="window.location.href='http://www.google.com';"&gt;

If you are using XHTML:

<input type="button" value="Back" onclick="window.location.href='http://www.google.com';" />
Guffa
A: 
<input type='button' value='click' onclick="window.location='http://google.com';" />
x13
A: 
David Dorward