From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/fr/web/api/document/location/index.html | 111 ++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 files/fr/web/api/document/location/index.html (limited to 'files/fr/web/api/document/location') diff --git a/files/fr/web/api/document/location/index.html b/files/fr/web/api/document/location/index.html new file mode 100644 index 0000000000..afd9341feb --- /dev/null +++ b/files/fr/web/api/document/location/index.html @@ -0,0 +1,111 @@ +--- +title: Document.location +slug: Web/API/Document/location +tags: + - API + - Document + - HTML DOM + - Propriété + - Reference + - lecture seule +translation_of: Web/API/Document/location +--- +

La propriété en lecture seule Document.location renvoie un objet {{domxref("Location")}}, contenant les informations sur l'URL du document et fournit des moyens pour modifier cette URL ou charger une autre URL.

+ +

Bien que Document.location soit un objet  Location en lecture seule, vous pouvez lui assigner un {{domxref("DOMString")}}. Cela signifie que vous pouvez dans la plupart des cas utiliser document.location comme s'il s'agissait d'une chaîne de caractères: document.location = 'http://www.example.com' est un synonyme de document.location.href = 'http://www.example.com'.

+ +

Pour récupérer uniquement l'URL en tant que chaîne de caractères, la propriété {{domxref("document.URL")}} peut également être utilisée.

+ +

Si le document courant n'est pas un contexte de navigation, la valeur renvoyée est null.

+ +

Syntaxe

+ +
locationObj = document.location
+document.location = 'http://www.mozilla.org' // équivalent à document.location.href = 'http://www.mozilla.org'
+
+ +

Exemple

+ +
console.log(document.location);
+// Affiche un string-like
+// "http://www.example.com/juicybits.html" dans la console
+
+ +

Spécification

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', "history.html#the-location-interface", "Document.location")}}{{Spec2('HTML WHATWG')}}Pas de changement avec {{SpecName("HTML5 W3C")}}.
{{SpecName('HTML5 W3C', "browsers.html#the-location-interface", "Document.location")}}{{Spec2('HTML5 W3C')}}Définition initiale.
+ +

Compatibilité des navigateurs

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FonctionChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Support de base{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FonctionAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Support de base{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Voir également

+ + -- cgit v1.2.3-54-g00ecf