aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/api/url
diff options
context:
space:
mode:
Diffstat (limited to 'files/pt-br/web/api/url')
-rw-r--r--files/pt-br/web/api/url/createobjecturl/index.html42
-rw-r--r--files/pt-br/web/api/url/index.html113
-rw-r--r--files/pt-br/web/api/url/revokeobjecturl/index.html107
-rw-r--r--files/pt-br/web/api/url/searchparams/index.html45
4 files changed, 307 insertions, 0 deletions
diff --git a/files/pt-br/web/api/url/createobjecturl/index.html b/files/pt-br/web/api/url/createobjecturl/index.html
new file mode 100644
index 0000000000..430b49c457
--- /dev/null
+++ b/files/pt-br/web/api/url/createobjecturl/index.html
@@ -0,0 +1,42 @@
+---
+title: URL.createObjectURL()
+slug: Web/API/URL/createObjectURl
+translation_of: Web/API/URL/createObjectURL
+---
+<p>{{ApiRef("URL API")}}{{SeeCompatTable}}</p>
+
+<h2 id="Summary" name="Summary">Resumo</h2>
+
+<p>Cria um novo objeto URL, cujo tempo de vida está ligado ao {{domxref("document")}} na janela na qual este objeto foi criado. O novo objeto URL representa o objeto {{domxref("File")}} ou o objeto {{domxref("Blob")}} passado como argumento.</p>
+
+<h2 id="Syntax" name="Syntax">Sintaxe</h2>
+
+<pre class="syntaxbox"><em>objetoURL</em> = window.URL.createObjectURL(blob);
+</pre>
+
+<ul>
+ <li><code>blob</code> é um objeto do tipo {{domxref("File")}} ou {{domxref("Blob")}} para o qual se deseja criar um objeto URL.</li>
+ <li><code>objetoURL</code> é o objeto URL gerado. O conteúdo completo do arquivo especificado é representado pelo texto do objeto URL.</li>
+</ul>
+
+<h2 id="Example" name="Example">Exemplo</h2>
+
+<p>Veja <a href="/en-US/docs/Using_files_from_web_applications#Example.3A_Using_object_URLs_to_display_images" title="https://developer.mozilla.org/en/Using_files_from_web_applications#Example:_Using_object_URLs_to_display_images">Using object URLs to display images</a>.</p>
+
+<h2 id="Notes" name="Notes">Notas</h2>
+
+<p>Cada vez que a função <code>createObjectURL()</code> é chamada, um novo objeto URL é criado, mesmo se você já tiver criado um objeto URL para esse mesmo arquivo. Cada objeto URL criado precisa ser liberado por meio de uma chamada a {{domxref("window.URL.revokeObjectURL()")}} quando este não for mais necessário. Os navegadores liberarão os objetos URL criados automaticamente quando o documento for descarregado; no entanto, para um desempenho e um gerenciamento de memória ótimos, se houver algum momento em que você puder liberar estes recursos explicitamente, você deveria fazê-lo.</p>
+
+<h2 id="Browser_Compatibility" name="Browser_Compatibility">Compatibilidade de navegadores</h2>
+
+
+
+<p>{{Compat("api.URL.createObjectURL")}}</p>
+
+<h2 id="See_also" name="See_also">Veja também</h2>
+
+<ul>
+ <li>{{domxref("URL.revokeObjectURL()")}}</li>
+ <li><a href="/en-US/docs/Using_files_from_web_applications" title="Using files from web applications">Using files from web applications</a></li>
+ <li>Especificação <a class="external" href="http://www.w3.org/TR/FileAPI/#dfn-createObjectURL" title="http://dev.w3.org/2006/webapi/FileAPI/#url">File API</a></li>
+</ul>
diff --git a/files/pt-br/web/api/url/index.html b/files/pt-br/web/api/url/index.html
new file mode 100644
index 0000000000..6e24c8efe7
--- /dev/null
+++ b/files/pt-br/web/api/url/index.html
@@ -0,0 +1,113 @@
+---
+title: URL
+slug: Web/API/URL
+translation_of: Web/API/URL
+---
+<div>{{ApiRef("URL API")}} {{SeeCompatTable}}</div>
+
+<p>The <strong><code>URL</code></strong><strong> </strong>interface represent an object providing static methods used for creating object URLs.</p>
+
+<p>When using a user agent where no constructor has been implemented yet, it is possible to access such an object using the non-standard {{domxref("Window.URL")}} properties (prefixed with Webkit- and Blink-based browser as <code>Window.webkitURL</code>).</p>
+
+<h2 id="Properties">Properties</h2>
+
+<p><em>Implements properties defined in {{domxref("URLUtils")}}.</em></p>
+
+<dl>
+ <dt>{{domxref("URLUtils.href")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing the whole URL.</dd>
+ <dt>{{domxref("URLUtils.protocol")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing the protocol scheme of the URL, including the final <code>':'</code>.</dd>
+ <dt>{{domxref("URLUtils.host")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing the host, that is the <em>hostname</em>, a <code>':'</code>, and the <em>port</em> of the URL.</dd>
+ <dt>{{domxref("URLUtils.hostname")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing the domain of the URL.</dd>
+ <dt>{{domxref("URLUtils.port")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing the port number of the URL.</dd>
+ <dt>{{domxref("URLUtils.pathname")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing an initial <code>'/'</code> followed by the path of the URL.</dd>
+ <dt>{{domxref("URLUtils.search")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing a <code>'?'</code> followed by the parameters of the URL.</dd>
+ <dt>{{domxref("URLUtils.hash")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing a <code>'#'</code> followed by the fragment identifier of the URL.</dd>
+ <dt>{{domxref("URLUtils.username")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing the username specified before the domain name.</dd>
+ <dt>{{domxref("URLUtils.password")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} containing the password specified before the domain name.</dd>
+ <dt>{{domxref("URLUtils.origin")}} {{readonlyInline}}</dt>
+ <dd>Returns a {{domxref("DOMString")}} containing the origin of the URL, that is its scheme, its domain and its port.</dd>
+</dl>
+
+<dl>
+ <dt>{{domxref("URLUtils.searchParams")}}</dt>
+ <dd>Returns a {{domxref("URLSearchParams")}} object allowing to access the GET query arguments contained in the URL.</dd>
+</dl>
+
+<h2 id="Constructor">Constructor</h2>
+
+<dl>
+ <dt>{{domxref("URL.URL", "URL()")}}</dt>
+ <dd>Creates and return a <code>URL</code> object composed from the given parameters.</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<p><em>The <code>URL</code> interface implements methods defined in {{domxref("URLUtils")}}.</em></p>
+
+<dl>
+ <dt>{{domxref("URLUtils.toString()")}}</dt>
+ <dd>Returns a {{domxref("DOMString")}} containing the whole URL. It is a synonym for {{domxref("URLUtils.href")}}, though it can't be used to modify the value.</dd>
+</dl>
+
+<h2 id="Static_methods">Static methods</h2>
+
+<dl>
+ <dt>{{ domxref("URL.createObjectURL()") }}</dt>
+ <dd>Returns a {{domxref("DOMString")}} containing a unique blob URL, that is a URL with <code>blob:</code> as its scheme, followed by an opaque string uniquely identifying the object in the browser.</dd>
+ <dt>{{ domxref("URL.revokeObjectURL()") }}</dt>
+ <dd>Revokes an object URL previously created using {{ domxref("URL.createObjectURL()") }}.</dd>
+</dl>
+
+<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('File API', '#creating-revoking', 'URL')}}</td>
+ <td>{{Spec2('File API')}}</td>
+ <td>Added the static methods <code>URL.createObjectURL()</code> and <code>URL.revokeObjectURL</code><code>()</code>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('URL', '#api', 'Node')}}</td>
+ <td>{{Spec2('URL')}}</td>
+ <td>Initial definition (implements <code>URLUtils</code>).</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{Compat("api.URL")}}</p>
+
+<p>[1] From Gecko 2 (Firefox 4) to Gecko 18 included, Gecko supported this interface with the non-standard <code>nsIDOMMozURLProperty</code> internal type. As the only to access such an object was through {{domxref("window.URL")}}, in practice, this didn't make any difference.</p>
+
+<h2 id="Chrome_Code_-_Scope_Availability">Chrome Code - Scope Availability</h2>
+
+<p>To use from chrome code, JSM and Bootstrap scope, you have to import it like this:</p>
+
+<pre class="brush: js notranslate">Cu.importGlobalProperties(['URL']);
+</pre>
+
+<p><code>URL</code> is available in Worker scopes.</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>Property allowing to get such an object: {{domxref("Window.URL")}}.</li>
+ <li><a href="/en-US/docs/Components.utils.importGlobalProperties">Components.utils.importGlobalProperties</a></li>
+</ul>
diff --git a/files/pt-br/web/api/url/revokeobjecturl/index.html b/files/pt-br/web/api/url/revokeobjecturl/index.html
new file mode 100644
index 0000000000..1a6c34027d
--- /dev/null
+++ b/files/pt-br/web/api/url/revokeobjecturl/index.html
@@ -0,0 +1,107 @@
+---
+title: URL.revokeObjectURL()
+slug: Web/API/URL/revokeObjectURL
+translation_of: Web/API/URL/revokeObjectURL
+---
+<p>{{ApiRef("URL")}}{{SeeCompatTable}}</p>
+
+<h2 id="Resumo">Resumo</h2>
+
+<p>O método estático <strong><code>URL.revokeObjectURL()</code></strong> libera um objeto URL que foi criado préviamente chamando {{domxref("URL.createObjectURL()") }}.  Utilize este método quando terminar de usar um objeto URL, para informar o navegador que não é mais necessário manter a referência para o arquivo.</p>
+
+<p>{{AvailableInWorkers}}</p>
+
+<h2 id="Sintaxe">Sintaxe</h2>
+
+<pre class="syntaxbox">window.URL.revokeObjectURL(<em>objectURL</em>);
+</pre>
+
+<dl>
+ <dt><em>objectURL </em></dt>
+ <dd>é um {{domxref("DOMString")}} representando o objeto URL que foi criado chamando {{domxref("URL.createObjectURL()") }}.</dd>
+</dl>
+
+<ul>
+</ul>
+
+<h2 id="Exemplo">Exemplo</h2>
+
+<p>Veja <a href="/en-US/docs/Using_files_from_web_applications#Example_Using_object_URLs_to_display_images">Using object URLs to display images</a>.</p>
+
+<h2 id="Especificações">Especificações</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Especificação</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comentário</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('File API', '#dfn-revokeObjectURL', 'URL')}}</td>
+ <td>{{Spec2('File API')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidade_de_Navegadores">Compatibilidade de Navegadores</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>8.0<sup>[1]</sup></td>
+ <td>{{CompatGeckoDesktop(2.0)}}</td>
+ <td>10.0</td>
+ <td>15.0</td>
+ <td>6.0<sup>[1]</sup><br>
+ 7.0</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}<sup>[1]</sup></td>
+ <td>{{CompatGeckoMobile(14.0)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>15.0</td>
+ <td>6.0<sup>[1]</sup><br>
+ 7.0</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] Implementado com prefixo de URL como <code>webkitURL</code>.</p>
+
+<h2 id="Veja_também">Veja também</h2>
+
+<ul>
+ <li>{{domxref("URL.createObjectURL()") }}</li>
+ <li><a href="/en-US/docs/Using_files_from_web_applications">Using files from web applications</a></li>
+</ul>
diff --git a/files/pt-br/web/api/url/searchparams/index.html b/files/pt-br/web/api/url/searchparams/index.html
new file mode 100644
index 0000000000..a711b85fa2
--- /dev/null
+++ b/files/pt-br/web/api/url/searchparams/index.html
@@ -0,0 +1,45 @@
+---
+title: URL.searchParams
+slug: Web/API/URL/searchParams
+translation_of: Web/API/URL/searchParams
+---
+<p>{{APIRef("")}}</p>
+
+<p>A propriedade <strong><code>searchParams</code></strong> da interface {{domxref("URL")}} retorna um objeto {{domxref("URLSearchParams")}} permitindo acesso aos parâmetros enviados via GET que uma URL possui.</p>
+
+<h2 id="Sintaxe">Sintaxe</h2>
+
+<pre class="syntaxbox notranslate">var urlSearchParams = URL.searchParams;</pre>
+
+<h3 id="Valor">Valor</h3>
+
+<p>Um objeto {{domxref("URLSearchParams")}}.</p>
+
+<h2 id="Exemplo">Exemplo</h2>
+
+<p>Se a URL da sua página é <code>https://example.com/?name=Jonathan&amp;age=18</code> você pode parsear os parametros 'name' e 'age' usando:</p>
+
+<pre class="default prettyprint prettyprinted notranslate">let params = (new URL(document.location)).searchParams;
+let name = params.get("name"); // é a string "Jonathan"
+let age = parseInt(params.get("age")); // é o número 18</pre>
+
+<h2 id="Especificações">Especificações</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('URL', '#dom-url-searchparams', 'searchParams')}}</td>
+ <td>{{Spec2('URL')}}</td>
+ <td>Definição inicial.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{Compat("api.URL.searchParams")}}</p>