window.location是页面的位置对象,window.location.href是 location的一个属性值,并且它是location的默认属性就是说对window.location直接赋值一个url实际上就是对window.location.href赋值。location对象除了有href属性外还有很多其他属性和方法,而href就是一个字符串只不过修改location的href会触发浏览器加载 href所指向的url。因此不存在前者速度比后者快的。
转载于:https://www.cnblogs.com/wujiaxuan/p/11104470.html
本文详细解析了window.location对象及其属性href的作用,说明了window.location与window.location.href在网页定位中的应用并无速度差异,同时阐述了location对象的其他属性和方法。
9673

被折叠的 条评论
为什么被折叠?



