1、window.location.href(设置或获取整个 URL 为字符串)

2、window.location.protocol(设置或获取 URL 的协议部分)

3、window.location.host(设置或获取 URL 的主机部分)

4、window.location.port(设置或获取与 URL 关联的端口号码)

5、window.location.pathname(设置或获取与 URL 的路径部分(就是文件地址))

6、window.location.search(设置或获取 href 属性中跟在问号后面的部分)

7、window.location.hash(设置或获取 href 属性中在井号“#”后面的分段)

参考地址:https://www.cnblogs.com/zhabayi/p/6419938.html

js获取当前url的更多相关文章

  1. js获取页面url的方法

    我们可以用javascript获得其中的各个部分 1, window.location.href 整个URl字符串(在浏览器中就是完整的地址栏) 本例返回值: http://ifisker.com/b ...

  2. js 获取当前页url网址信息

    转载地址:js如何准确获取当前页面url网址信息 摘录: 举例一个URL,然后获得它的各个组成部分:http://i.cnblogs.com/EditPosts.aspx?opt=1 1.window ...

  3. JS获取页面URL信息

    下面我们举例一个URL,然后获得它的各个组成部分: http://i.cnblogs.com/EditPosts.aspx?opt=1 window.location.href (设置或获取整个 UR ...

  4. js 获取当前URL信息

    document.location 这个对象包含了当前URL的信息 location.host 获取port号 location.hostname 设置或获取主机名称 location.href 设置 ...

  5. js获取页面url

    设置或获取对象指定的文件名或路径. window.location.pathname例:http://localhost:8086/topic/index?topicId=361alert(windo ...

  6. js获取当前url信息

    window.location 属性 描述 hash 设置或获取 href 属性中在井号"#"后面的分段. host 设置或获取 location 或 URL 的 hostname ...

  7. js获取当前url地址及参数

    介绍:设置或获取对象指定的文件名或路径. window.location.pathname //返回 设置或获取整个 URL 为字符串. window.location.href 设置或获取与 URL ...

  8. JS获取浏览器URL中查询字符串的参数

    首先要知道Location这个对象以及这个对象中的一些属性: href:设置或返回完整的url.如本博客首页返回http://www.cnblogs.com/wymninja/ host:设置或返回主 ...

  9. js 获取图片url的Blob值并预览

    1)使用 XMLHttpRequest 对象获取图片url的Blob值 //获取图片的Blob值 function getImageBlob(url, cb) { var xhr = new XMLH ...

随机推荐

  1. hash一致性

    参照:https://www.cnblogs.com/moonandstar08/p/5405991.html 参照:http://www.cnblogs.com/haippy/archive/201 ...

  2. Flask技术问题汇总

    1:Flask 使用 request对象代理了当前请求的上下文.这么做什么好处和坏处? 好处:flask封装了C端发起request对象,这样就可以使用上下文临时把某些对象变为全局可访问:如果不封装, ...

  3. MFC俄罗斯方块

    经典俄罗斯方块游戏 源码百度云链接 链接:https://pan.baidu.com/s/14frk2EuFoiRCzudol2Xgvg提取码:syzk GitHub https://github.c ...

  4. UE3中Object和Actor的创建与销毁

    创建Object ① 在uc脚本中使用new运算符来创建 /********************************************************************** ...

  5. Thymeleaf 的 onclick

    th:onclick="'javascript:openBox(\''+${curCabNo}+'\',\''+${box.no}+'\')'" 真的难受 ,有没有好办法!!!!

  6. AngularJS学习之旅—AngularJS 模块(十五)

    一.AngularJS 模块 模块定义了一个应用程序. 模块是应用程序中不同部分的容器. 模块是应用控制器的容器. 控制器通常属于一个模块. 1.创建模块 通过 AngularJS 的 angular ...

  7. IOS开发证书常见问题

    1.本地Provisioning Profiles存放路径 ~/Library/MobileDevice/Provisioning Profiles 2.this action could not b ...

  8. (win10 docker desktop) docker build 时 alpine 无法安装软件问题的解决

    使用 alpine 作为 docker 基础镜像时,运行 apk add ..... 遇到如下错误: WARNING: Ignoring http://dl-cdn.alpinelinux.org/a ...

  9. Rabbitmq集群高可用

    转载:https://www.cnblogs.com/flat_peach/archive/2013/04/07/3004008.html RabbitMQ是用erlang开发的,集群非常方便,因为e ...

  10. postman Installation has failed: There was an error while installing the application. Check the setup log for more information and contact the author

    Error msg: Installation has failed: There was an error while installing the application. Check the s ...