window.location.href
is not a method, it's a property that will tell you the current URL location of the browser.
(window.location.href
不是一个方法,它是一个告诉你浏览器当前URL位置的属性。)
Changing the value of the property will redirect the page.(更改属性的值将重定向页面。)
window.open()
is a method that you can pass a URL to that you want to open in a new window.
(window.open()
是一种方法,您可以将URL传递给要在新窗口中打开的URL。)
For example:(例如:)
window.location.href example:
(window.location.href示例:)
window.location.href = 'http://www.google.com'; //Will take you to Google.
window.open() example:
(window.open()示例:)
window.open('http://www.google.com'); //This will open Google in a new window.
Additional Information:
(附加信息:)
window.open()
can be passed additional parameters.
(window.open()
可以传递其他参数。)
See: window.open tutorial(请参阅: window.open教程)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…