From af3288b106f44aaaa2c80d499ec669383d6f7203 Mon Sep 17 00:00:00 2001 From: MDN Date: Wed, 1 Sep 2021 00:52:00 +0000 Subject: [CRON] sync translated content --- files/fr/web/api/origin/index.html | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 files/fr/web/api/origin/index.html (limited to 'files/fr/web/api/origin') diff --git a/files/fr/web/api/origin/index.html b/files/fr/web/api/origin/index.html new file mode 100644 index 0000000000..5fd2b80559 --- /dev/null +++ b/files/fr/web/api/origin/index.html @@ -0,0 +1,51 @@ +--- +title: WindowOrWorkerGlobalScope.origin +slug: Web/API/origin +translation_of: Web/API/WindowOrWorkerGlobalScope/origin +original_slug: Web/API/WindowOrWorkerGlobalScope/origin +--- +

{{APIRef()}}{{SeeCompatTable}}

+ +

La propriété origin de l'interface {{domxref("WindowOrWorkerGlobalScope")}} retourne l'origine du scope global, serialisé en chaîne de caractères.

+ +

Syntaxe

+ +
var myOrigin = self.origin; // ou simplement origin
+
+ +

Valeur

+ +

Une {{domxref("USVString")}}.

+ +

Exemples

+ +

Exécuté depuis un worker, le code suivant permet d'afficher en console le scope global de ce worker à chaque message reçu.

+ +
onmessage = function() {
+  console.log(self.origin);
+};
+ +

Si l'origine n'est pas sous la forme scheme/host/port (par exemple, si vous exécutez le code en local, via file://), origin retournera la chaîne de caractère "null".

+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationStatutCommentaires
{{SpecName('HTML WHATWG', 'webappapis.html#dom-origin', 'WindowOrWorkerGlobalScope.origin')}}{{Spec2('HTML WHATWG')}}Définition initiale.
+ +

Compatibilité des navigateurs

+ + + +

{{Compat("api.WindowOrWorkerGlobalScope.origin")}}

-- cgit v1.2.3-54-g00ecf