网站首页 > 知识剖析 正文
以网址 https://mp.toutiao.com:8888/search?q=123#hash 为例子说明对应的属性值
location.origin //协议+域名+端口
返回: https://mp.toutiao.com:8888
location.hostname //web主机的域名
返回:mp.toutiao.com
location.host //主机的域名+端口
返回:mp.toutiao.com:8888
location.pathname //当前页面的路径和文件名
返回:/search/
location.port //web的端口
返回:8888
location.protocol //web协议http:// 或 https://
返回:https:
location.href //当前页面的 URL
返回:https://mp.toutiao.com:8888/search?q=123#hash
location.search //?以及后面参数部分(包含?)
返回:?q=123
location.hash //锚点
返回:#hash
猜你喜欢
- 2024-11-24 浏览器跨域问题以及常用解决方案
- 2024-11-24 14个前端小知识,我猜你每天都会遇到
- 2024-11-24 跨域问题的4种解决方案
- 2024-11-24 什么是跨域?跨域解决方法
- 2024-11-24 构建rancher自定义ui的前端镜像
- 2024-11-24 你应该知道的前端小知识,初学者,确定不点进来看看吗?
- 2024-11-24 15个前端小知识
- 2024-11-24 记一场纯JS赛——DiceCTF2021 Web题解
- 2024-11-24 如何基于 Elasticsearch 实现排序沉底或前置
- 2024-11-24 如何查找网站源IP地址
- 最近发表
- 标签列表
-
- xml (46)
- css animation (57)
- array_slice (60)
- htmlspecialchars (54)
- position: absolute (54)
- datediff函数 (47)
- array_pop (49)
- jsmap (52)
- toggleclass (43)
- console.time (63)
- .sql (41)
- ahref (40)
- js json.parse (59)
- html复选框 (60)
- css 透明 (44)
- css 颜色 (47)
- php replace (41)
- css nth-child (48)
- min-height (40)
- xml schema (44)
- css 最后一个元素 (46)
- location.origin (44)
- table border (49)
- html tr (40)
- video controls (49)