You might set location
directly because it's slightly shorter.(您可能会直接设置location
,因为它的location
略短。)
If you're trying to be terse, you can usually omit the window.
(如果您要简洁,通常可以省略window.
) too.(太。)
URL assignments to both location.href
and location
are defined to work in JavaScript 1.0, back in Netscape 2, and have been implemented in every browser since.(URL分配给location.href
和location
的定义都可以在JavaScript 1.0中使用,也可以在Netscape 2中使用,并且此后已在每个浏览器中实现。) So take your pick and use whichever you find clearest.(因此,请选择并使用最清晰的内容。) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…