window.location是页面的位置对象
window.location.href是 location的一个属性值,并且它是location的默认属性。

window.location直接赋值一个url实际上就是对window.location.href赋值。

location对象除了有href属性外还有很多其他属性。

上个图更清晰:

从图上可以看出来每一部分的表示,举个例子

location.pathname -- 返回URL的域名后的部分。例如 https://www.baidu.com/xhtml/ 返回/xhtml/

页面的URL分析----window.location.href的更多相关文章

  1. document.URL vs window.location.href All In One

    document.URL vs window.location.href All In One document.URL 与 window.location.href 两者有啥区别 document. ...

  2. 【JavaScript】获取当前页的URL与window.location.href

    原文:http://blog.csdn.net/yongh701/article/details/45688743 版权声明:本文为博主原创文章,未经博主允许欢迎乱转载,标好作者就可以了!感谢欣赏!觉 ...

  3. JS 中document.URL 和 window.location.href 的区别

    实际上,document 和 window 这两个对象的区别已经包含了这个问题的答案. document 表示的是一个文档对象,window 表示一个窗口对象. 一个窗口下面可以有很多的documen ...

  4. window.location.href和window.open的几种用法和区别

    使用js的同学一定知道js的location.href的作用是什么,但是在js中关于location.href的用法究竟有哪几种,究竟有哪些区别,估计很多人都不知道了. 一.location.href ...

  5. windows.open、 window.location.href

    windows.open("URL","窗口名称","窗口外观设定");打开新窗口,window对象的方法 不一定打开新窗口,只要有窗口的名 ...

  6. JavaScript在IE6下超级链接window.location.href不跳转的bug 及 解决方案

    今天遇到个很诡异的问题,就是<a href="javascript:void(0);" onclick="window.location.href=url" ...

  7. window.location.assign和window.location.href区别

    window.location.assign和window.location.href区别 window.location.assign(url)和window.location.href=url实现 ...

  8. IE6下window.location.href不跳转到相应url

    前天一同事遇到个看似很诡异的问题,就是<a href="javascript:void(0);" onclick="window.location.href=url ...

  9. window.location.href url含中文服务器收到乱码问题解决

    中文乱码问题 window.location.href url含中文服务器收到乱码问题解决 (1).页面中先对中文进行编码. 如:window.location.href = url+"&a ...

随机推荐

  1. Windows远程桌面和360

    Windows的远程桌面输错了一次密码, 然后就怎么都连接不上了, 查了半天发现 傻缺360会默认屏蔽Windows的远程桌面和数据库连接..... 大家没事都卸载了360吧

  2. 【转】使用Docker+Jenkins自动构建部署

    转载自 https://segmentfault.com/a/1190000012921606 环境 阿里云ESC,宿主机服务器安装Docker,在安全规则中确认8080端口开启. 客户端mac 运行 ...

  3. Spring《二》 Bean的生命周期

    Bean初始化 1.bean中实现public void init():方法,config.xml中增加init-method="init" 属性. 2.bean实现接口Initi ...

  4. Selenium键盘鼠标操作总结

    鼠标操作 org.openqa.selenium.interactions.Actions 1.给元素设置焦点. 有时对于a标签等,为了不跳转到别的链接,但是需要设置焦点时就可使用. action.m ...

  5. IntelliJ Idea下Go项目开启Debug调试

    1.新建Go项目,创建入口go文件(Test1.go),随便写点啥,比如: package main import "fmt" func main(){ fmt.Println(& ...

  6. C++ 简单内存泄漏检测方法

    遇到个bug,MFC程序异常退出,debug模式下输出 Detected memory leaks! Dumping objects -> {366566} normal block at 0x ...

  7. Functional programming-函数式编程

    In computer science, functional programming is a programming paradigm—a style of building the struct ...

  8. Day 05 流程控制

    流程控制 if 判断 语法: if if...else if...elif...else if判断是干什么的呢?if判断其实是在模拟人做判断.就是说如果这样干什么,如果那样干什么. if...else ...

  9. webpack初识(biaoyansu)

    1.是什么和为什么 在浏览器中的js之间如果需要相互依赖 src=a.js src=b.js src=c.js src=d.js 需要暴露出全局变量,而暴露出的这个全局变量是非常不安全的, 随着Nod ...

  10. zabbbix4.0升级到4.2

    一.添加Zabbix存储库 1.安装存储库配置包. rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4 ...