aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/navigator/canshare/index.html
blob: 6f807819d75b84202cde5c6a6ca21637f480946a (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
47
48
49
50
51
52
---
title: Navigator.canShare
slug: Web/API/Navigator/canShare
translation_of: Web/API/Navigator/canShare
---
<div>{{APIRef("HTML DOM")}}{{SeeCompatTable}}{{securecontext_header}}</div>

<div></div>

<div>如果对<code><a href="/zh-CN/docs/Web/API/Navigator/share">Navigator.share()</a></code> 的调用成功,则Web Share API的<strong><code>Navigator.canShare()</code></strong>方法将返回true。</div>

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

<pre class="syntaxbox">var canShare = <em>navigator</em>.canShare(<em>data</em>);</pre>

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

<dl>
 <dt><code>data</code> {{optional_inline}}</dt>
 <dd>包含要共享的数据的对象,该对象要与{{domxref("Navigator.share()")}}方法传递的数据相匹配。</dd>
</dl>

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

<p>{{jsxref('Boolean')}}值. {{domxref("Navigator.share()")}}若返回True则表示内容可以被成功分享。</p>

<h2 id="规范">规范</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('Web Share API 2','#canshare-method','canShare')}}</td>
   <td>{{Spec2('Web Share API 2')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

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



<p>{{Compat("api.Navigator.canShare")}}</p>

<h2 id="相关连接">相关连接</h2>

<p>{{domxref('navigator.share', 'navigator.share()')}}</p>