aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/navigator/share/index.html
blob: 852999aeb6c6936b89e2f9460a3a9983ae78cae5 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: Navigator.share
slug: Web/API/Navigator/share
translation_of: Web/API/Navigator/share
---
<div>{{APIRef("HTML DOM")}}{{SeeCompatTable}}</div>

<p><strong><code>Navigator.share()</code></strong> 메소드는 Web Share API 의 부분으로서 디바이스의 네이티브 공유하기 메커니즘을 작동시킨다. Web Share API 가 지원되지 않는다면, 이 메소드는 <code>undefined</code> 일 것이다.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="syntaxbox">var sharePromise = window.navigator.share(<var>data</var>);
</pre>

<h3 id="Parameters">Parameters</h3>

<dl>
 <dt><var>data</var></dt>
 <dd>공유할 데이터가 담긴 객체. 아래의 필드들 중 적어도 하나는 명시되어야 한다. 사용 가능한 옵션들은:</dd>
</dl>

<ul>
 <li><code>url</code>: 공유될 URL을 나타내는 {{domxref("USVString")}}.</li>
 <li><code>text</code>: 공유될 본문을 나타내는 {{domxref("USVString")}}.</li>
 <li><code>title</code>: 공유될 제목을 나타내는 {{domxref("USVString")}}.</li>
</ul>

<dl>
</dl>

<h3 id="Return_value">Return value</h3>

<p>사용자가 공유하기 액션을 완료하면 resolve 될 {{domxref("Promise")}}. <var>data</var> 파라메터가 정확하게 명시되지 않는다면 즉시 reject 될 것이다.</p>

<p>예를 들어, 안드로이드용 크롬에서 반환되는 <code>Promise</code> 는 사용자가 공유할 애플리케이션을 선택한 후에 resolve 될 것이다.</p>

<h2 id="Examples">Examples</h2>

<pre class="brush: js">navigator.share({
  title: document.title,
  text: 'Hello World',
  url: 'https://developer.mozilla.org',
}); // share the URL of MDN</pre>

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

<table>
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('Web Share API','#share-method','share()')}}</td>
   <td>{{Spec2('Web Share API')}}</td>
   <td></td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>



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