aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/api/document/origin/index.html
blob: afbf5d87fb9591bd576df9e04d2e7e7074602f6b (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
---
title: Document.origin
slug: Web/API/Document/origin
translation_of: Web/API/Document/origin
---
<div>{{APIRef("DOM")}}{{SeeCompatTable}}</div>

<p>A propriedade read-only <strong><code>Document.origin</code></strong> retorna a origem do documento. Na maioria dos casos, essa propriedade é equivalente a <code>document.defaultView.location.origin</code>.</p>

<h2 id="Sintaxe">Sintaxe</h2>

<pre class="syntaxbox">var <var>origin</var> = <var>document</var>.origin;</pre>

<h2 id="Exemplos">Exemplos</h2>

<pre class="brush: js">var origin = document.origin;
// Nesta página, retorna:'https://developer.mozilla.org'

var origin = document.origin;
// Em "about:blank", retorna:'null'

var origin = document.origin;
// Em "data:text/html,&lt;b&gt;foo&lt;/b&gt;", retorna:'null'
</pre>

<h2 id="Especificações">Especificações</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Especificação</th>
   <th scope="col">Status</th>
   <th scope="col">Comentário</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('DOM WHATWG', '#dom-document-origin', 'Document.origin')}}</td>
   <td>{{Spec2('DOM WHATWG')}}</td>
   <td>Definição inicial.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', '#concept-origin', 'origin for various objects (including Document objects)')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>Definição inicial.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Compatibilidade com navegadores</h2>



<div>{{Compat("api.Document.origin")}}</div>

<h2 id="Veja_também">Veja também </h2>

<ul>
 <li>A propriedade {{domxref("URLUtils.origin")}}.</li>
</ul>