JavaScript window.location.replace

JavaScript window.location.replace,javascript,replace,window,href,Javascript,Replace,Window,Href,我试图弄明白为什么下面的代码可以在Internet Explorer中使用,但不能在Chrome或Firefox中使用: <script language='javascript'> window.location.replace = 'http://home.php' </script> window.location.replacehttp://home.php' 当我将单词“replace”改为“href”时,它将在Chrome和Firefox中工作

我试图弄明白为什么下面的代码可以在Internet Explorer中使用,但不能在Chrome或Firefox中使用:

 <script language='javascript'>
   window.location.replace = 'http://home.php'
 </script>

window.location.replacehttp://home.php'
当我将单词“replace”改为“href”时,它将在Chrome和Firefox中工作,但在IE中不再工作


对此有什么解释吗?

replace
是针对IE的

直接分配到
窗口。位置要使其可移植:

window.location = 'http://home.php'

您不是想使用
replace()
方法而不是属性吗?我相信
window.location.replace
是一个函数。请参阅