Need current browser location information? Keep in mind that the JavaScript's window.location object gives you all of that information about the window's current location.
需要当前浏览器的位置信息? 请记住,JavaScript的window.location对象为您提供了有关窗口当前位置的所有信息。
How can this be used? One example is doing a JavaScript redirect:
如何使用? 一个示例是执行JavaScript重定向:
window.location = 'https://davidwalsh.name'; //redirects to homepageOr you could use it to compare link hrefs to find out if a link is external or internal. Or you could build a sweet history manager!
或者,您可以使用它来比较链接href,以找出链接是外部链接还是内部链接 。 或者您可以建立一个甜蜜的历史经理 !
翻译自: https://davidwalsh.name/javascript-window-location
相关资源:jdk-8u281-windows-x64.exe