Somnath Mulukmasif提出了一个问题:Window.location.href and Window.open () methods in JavaScript,或许与您遇到的问题类似。
回答者James Hill给出了该问题的处理方式:
window.location.href
is not a method, it's a property that will tell you the current URL location of the browser. 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. For example:
window.location.href example:
-------------------- - ------------------------ ------ ---- --- -- -------
window.open() example:
------------------------------------- ------ ---- ---- ------ -- - --- -------
Additional Information:
window.open()
can be passed additional parameters. See: window.open tutorial
希望本文对你有帮助,欢迎支持JavaScript中文网
来源:JavaScript中文网 ,转载请注明来源 本文地址:https://www.javascriptcn.com/post/9093