From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/pt-br/web/api/document/location/index.html | 108 +++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 files/pt-br/web/api/document/location/index.html (limited to 'files/pt-br/web/api/document/location') diff --git a/files/pt-br/web/api/document/location/index.html b/files/pt-br/web/api/document/location/index.html new file mode 100644 index 0000000000..ebf1f2aa27 --- /dev/null +++ b/files/pt-br/web/api/document/location/index.html @@ -0,0 +1,108 @@ +--- +title: Document.location +slug: Web/API/Document/location +translation_of: Web/API/Document/location +--- +

{{APIRef("DOM")}}

+ +

A propriedade, de apenas leitura, Document.location retorna um objeto {{domxref("Location")}}, que contém informações sobre a URL do documento e provém métodos para mudar a URL e carregar outra URL.

+ +

Embora Document.location seja um objeto Location de apenas leitura,  você pode atribuir um {{domxref("DOMString")}} para ele. Isso significa que você pode trabalhar com document.location, na maioria dos casos, como se fosse uma string: document.location = 'http://www.example.com' é um sinônimo de document.location.href = 'http://www.example.com'.

+ +

Para recuperar somente a URL como uma string, a propriedade de apenas leitura {{domxref("document.URL")}} pode ser utilizada.

+ +

Se o documento atual não estiver no contexto de navegação, o valor retornado será null.

+ +

Sintaxe

+ +
locationObj = document.location
+document.location = 'http://www.mozilla.org' // Equivalente a document.location.href = 'http://www.mozilla.org'
+
+ +

Exemplo

+ +
dump(document.location);
+// Imprime uma string como
+// "http://www.example.com/juicybits.html" to the console
+
+ +

Especificações

+ + + + + + + + + + + + + + + + + + + +
EspecificaçãoStatusComentário
{{SpecName('HTML WHATWG', "history.html#the-location-interface", "Document.location")}}{{Spec2('HTML WHATWG')}}Nenhuma mudança de {{SpecName("HTML5 W3C")}}.
{{SpecName('HTML5 W3C', "browsers.html#the-location-interface", "Document.location")}}{{Spec2('HTML5 W3C')}}Definição inicial.
+ +

Compatibilidade de navegadores

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
CaracterísticasChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Suporte básico{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
CaracterísticasAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Suporte básico{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Veja também

+ + + +

 

-- cgit v1.2.3-54-g00ecf