location详解

location 对象描述了与一个给定的 Window 对象关联的完整 URL
location 对象的每个属性都描述了 URL 的不同特性

通常情况下, 一个 URL 会有下面的格式

协议//主机:端口/路径名称#哈希标识?搜索条件

(1)
协议: URL 的起始部分, 直到包含到第一个冒号.
(2)主机: 描述了主机和域名, 或者一个网络主机的 IP 地址.
(3)端口: 描述了服务器用于通讯的通讯端口.
(4)路径名称: 描述了 URL 的路径方面的信息.
(5)哈希标识: 描述了 URL 中的锚名称, 包括哈希掩码(#). 此属性只应用于 HTTP 的 URL.
(6)搜索条件: 描述了该 URL 中的任何查询信息, 包括问号.

location属性
hash: Specifies an anchor name in the URL.
host: Specifies the host and domain name, or IP address, of a network host. 
hostname: Specifies the host:port portion of the URL. 
href: Specifies the entire URL. 
pathname: Specifies the URL-path portion of the URL. 
port: Specifies the communications port that the server uses. 
protocol: Specifies the beginning of the URL, including the colon. 
search: Specifies a query.

location方法
reload: Forces a reload of the window's current document. 
replace: Loads the specified URL over the current history entry.

转载于:https://www.cnblogs.com/miclu/archive/2007/10/17/927708.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值