HashChangeEvent newURL 属性

定义和用法

newURL 属性返回文档的 URL,在 hash(锚部分)更改后。

这是导航到的 URL。如需获取导航离开的 URL,请使用 oldURL 属性。

此属性是只读的。

提示:如需设置或返回 URL 的 hash,请使用 location.hash 属性。

实例

更改 hash 后,获取我们要导航到的 URL:

event.newURL;

亲自试一试

语法

event.newURL

技术细节

返回值: 字符串值,表示导航到的 URL。

Browser Support

The numbers in the table indicate the first browser version that fully supports the property.

Properties Chrome IE Firefox Safari Opera
newURL 5.0 Not Supported 6.0 5.0 10.6