aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/hashchangeevent/oldurl/index.html
blob: f93dd11624d1864c47b438bf723aaa164935aa5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: HashChangeEvent.oldURL
slug: Web/API/HashChangeEvent/oldURL
translation_of: Web/API/HashChangeEvent/oldURL
---
<div>{{APIRef("HTML DOM")}}</div>

<div></div>

<p><code><strong>oldURL</strong></code> 为 {{domxref("HashChangeEvent")}} 接口的只读属性,其值为窗口导航改变前的 URL。</p>

<h2 id="语法">语法</h2>

<pre class="syntaxbox notranslate">let <em>oldEventUrl</em> = <em>event</em>.oldURL;</pre>

<h3 id="返回值">返回值</h3>

<p>{{domxref("DOMString")}}.</p>

<h2 id="示例">示例</h2>

<pre class="brush: js notranslate">window.addEventListener('hashchange', function(event) {
  console.log('Hash changed from ' + event.oldURL);
});</pre>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">规范</th>
   <th scope="col">状态</th>
   <th scope="col">注释</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', '#dom-hashchangeevent-oldurl', 'HashChangeEvent: oldURL')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td></td>
  </tr>
 </tbody>
</table>