问题描述
window.location.href
属性的标准替代品是什么?我正在检查w3schools.com它是否在所有主流浏览器中实现,所以没有问题,但我很好奇如何正确地做到这一点。
What is a standardized alternative to window.location.href
property? I was checking on w3schools.com that it is implemented in all major browsers so there's no problem but I'm rather curious how to do that properly.
此处是函数未标准化的声明:
From here is the statement that the function is not standardized: https://developer.mozilla.org/en/DOM/window.location
谢谢!
推荐答案
窗口
对象可以追溯到Netscape 2.0中的原始JavaScript实现,并且从那时起,每个浏览器都存在 location
。
The window
object goes back as far as the original JavaScript implementation in Netscape 2.0, and location
has existed in every browser since then.
DOM之外的浏览器对象模型传统上没有标准化,但这会随HTML5而变化,HTML5会记录和。
The Browser Object Model outside of the DOM has tradionally not been standardised, but that changes with HTML5, which documents the window
object and its location
property explicitly.
这篇关于JavaScript中的window.location备选方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!