--- title: HashChangeEvent.oldURL slug: Web/API/HashChangeEvent/oldURL translation_of: Web/API/HashChangeEvent/oldURL ---
oldURL
为 {{domxref("HashChangeEvent")}} 接口的只读属性,其值为窗口导航改变前的 URL。
let oldEventUrl = event.oldURL;
{{domxref("DOMString")}}.
window.addEventListener('hashchange', function(event) { console.log('Hash changed from ' + event.oldURL); });
规范 | 状态 | 注释 |
---|---|---|
{{SpecName('HTML WHATWG', '#dom-hashchangeevent-oldurl', 'HashChangeEvent: oldURL')}} | {{Spec2('HTML WHATWG')}} |