Ian*_*ugh 4 html javascript internet-explorer-8
<input type="button" value="Back" onClick="window.navigate('http://www.google.com')">
Run Code Online (Sandbox Code Playgroud)
这适用于IE8,但不适用于Firefox或Opera.任何人都知道为什么以及如何解决它?
如果您查看该方法的文档,您会看到相当常见的:
没有适用于此方法的公共标准.
这意味着它是非标准功能,很可能只适用于Internet Explorer.
这将有效:
<input type="button" value="Back" onclick="window.location.href='http://www.google.com';">
Run Code Online (Sandbox Code Playgroud)
如果您使用的是XHTML:
<input type="button" value="Back" onclick="window.location.href='http://www.google.com';" />
Run Code Online (Sandbox Code Playgroud)
.navigate() 仅适用于 IE。
尝试设置 window.location。
window.location.href = 'http://www.google.com'
Run Code Online (Sandbox Code Playgroud)