aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/windowclient/navigate/index.html
blob: 546327430d1ab9056da2f14e167d7003903596d9 (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
42
43
44
45
46
---
title: WindowClient.navigate()
slug: Web/API/WindowClient/navigate
translation_of: Web/API/WindowClient/navigate
---
<p>{{SeeCompatTable}}{{APIRef("Service Workers API")}}</p>

<p>{{domxref("WindowClient")}} 接口的<strong><code> navigate() </code></strong>方法加载特定的 URL 地址到一个被控制的浏览器页面,并返回一个当前 {{domxref("WindowClient")}} 议的 {{jsxref("Promise")}} 对象。</p>

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

<pre class="syntaxbox"><em>WindowClient</em>.navigate(<em>url</em>).then(function(<em>WindowClient</em>) {
  // do something with your WindowClient after navigation
});</pre>

<h3 id="参数">参数</h3>

<dl>
 <dt><code>url</code></dt>
 <dd>跳转地址</dd>
</dl>

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

<p>一个 {{domxref("WindowClient")}}决议的{{jsxref("Promise")}}对象。</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Service Workers', '#client-navigate-method', 'navigate()')}}</td>
   <td>{{Spec2('Service Workers')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

{{Compat("api.WindowClient.navigate")}}