window.location属性

window.location 对象所包含的属性

属性 描述
hash 从井号 (#) 开始的 URL(锚)
host 主机名和当前 URL 的端口号
hostname 当前 URL 的主机名
href 完整的 URL
pathname 当前 URL 的路径部分
port 当前 URL 的端口号
protocol 当前 URL 的协议
search 从问号 (?) 开始的 URL(查询部分)

时间: 2024-08-07 06:01:04

window.location属性的相关文章

小tips:window.location属性

window.location 对象所包含的属性 属性  描述 hash 从井号 (#) 开始的 URL(锚) host 主机名和当前 URL 的端口号 hostname 当前 URL 的主机名 href 完整的 URL pathname 当前 URL 的路径部分 port 当前 URL 的端口号 protocol 当前 URL 的协议 search 从问号 (?) 开始的 URL(查询部分)

JS代码的window.location属性详解

window.location 对象所包含的属性 属性 描述 hash 从井号 (#) 开始的 URL(锚) host 主机名和当前 URL 的端口号 hostname 当前 URL 的主机名 href 完整的 URL pathname 当前 URL 的路径部分 port 当前 URL 的端口号 protocol 当前 URL 的协议 search 从问号 (?) 开始的 URL(查询部分)

window.location属性用法及解决一个window.location.search为什么为空的问题

通常用window.location该属性获取页面 URL 地址: 1.什么是window.location? 比如URL:http://b.a.com:88/index.php?name=kang&when=2011#first window.location和document.location互相等价的,可以交换使用 location的8个属性都是可读写的,但是只有href与hash的写才有意义. 例如:改变location.href会重新定位到一个URL,而修改location.hash会

window.location的方法属性详解

示例URL:http://b.a.com:88/index.php?name=kang&when=2011#first 属性 含义 值 protocol: 协议 "http:" hostname: 服务器的名字 "b.a.com" port: 端口 "88" pathname: URL中主机名后的部分 "/index.php" search: "?"后的部分,又称为查询字符串 "?name

location属性解释 - window.location & $location

window.location 所有浏览器都支持 window 对象.它表示浏览器窗口.所有 JavaScript 全局对象.函数以及变量均自动成为 window 对象的成员. 全局变量是 window 对象的属性 全局函数是 window 对象的方法 window.location 对象用于获得当前页面的地址 (URL)信息,并把浏览器重定向到新的页面,一般在编写时可不使用 window 这个前缀. 属性 描述 hash 设置或返回从#开始的 URL(锚) host 设置或返回主机名和当前 U

window.location下的属性说明

属性 说明 window.location.href 完整的url window.location.protocol 协议 window.location.hostname 主机名 window.location.host 主机名+端口号 window.location.port 端口号 window.location.pathname 当前URL的路径部分 var href  =  window.location.href;//完整的urlvar protocol  =  window.loc

window.location各属性含义

window.location方法获取URL 统一资源定位符 (Uniform Resource Locator, URL) 完整的URL由这几个部分构成: scheme://host:port/path?query#fragment scheme:通信协议  常用的http,ftp,maito等 host:主机 服务器(计算机)域名系统 (DNS) 主机名或 IP 地址. port:端口号 整数,可选,省略时使用方案的默认端口,如http的默认端口为80. path:路径 由零或多个"/&qu

window.location各属性的值

window.location.href            "https://i.cnblogs.com/EditPosts.aspx?opt=1" window.location.protocol      "https:" window.location.host           "i.cnblogs.com" window.location.port            返回端口号 window.location.pathname

window.location.hash的简单了解

location是javascript里边管理地址栏的内置对象,比如location.href就管理页面的url,用location.href=url就可以直接将页面重定向url.而location.hash则可以用来获取或设置页面的标签值.比如http://domain/#admin的location.hash="#admin".利用这个属性值可以做一个非常有意义的事情. 很多人都喜欢收藏网页,以便于以后的浏览.不过对于Ajax页面来说的话,一般用一个页面来处理所有的事务,也就是说,