From 13b1bd338b6f1443491b4e7889554868d74784f6 Mon Sep 17 00:00:00 2001 From: MDN Date: Fri, 12 Mar 2021 00:26:31 +0000 Subject: [CRON] sync translated content --- .../web/api/response/usefinalurl/index.html | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 files/ja/orphaned/web/api/response/usefinalurl/index.html (limited to 'files/ja/orphaned/web/api/response/usefinalurl') diff --git a/files/ja/orphaned/web/api/response/usefinalurl/index.html b/files/ja/orphaned/web/api/response/usefinalurl/index.html new file mode 100644 index 0000000000..06251f6c71 --- /dev/null +++ b/files/ja/orphaned/web/api/response/usefinalurl/index.html @@ -0,0 +1,61 @@ +--- +title: Response.useFinalURL +slug: orphaned/Web/API/Response/useFinalURL +tags: + - API + - Experimental + - Fetch + - Obsolete + - Property + - Reference + - Response + - useFinalURL +translation_of: Web/API/Response/useFinalURL +original_slug: Web/API/Response/useFinalURL +--- +
{{APIRef("Fetch")}}{{obsolete_header}}
+ +

{{domxref("Response")}} インターフェイスの useFinalURL プロパティには、これが response の最終URLかどうかを示すbook値が含まれています。

+ +
+

このプロパティは ServiceWorkers にのみに適用されます。他のコンテキストの場合、 undefined を返します。

+
+ +

構文

+ +
var isfinalURL = Response.useFinalURL;
+ +

+ +

URLがリダイレクトでなく最終的なものかどうかを示す {{domxref("Boolean")}}

+ +

+ +

ページ index.html にあるスクリプトで考えてみます:

+ +
fetch('/test').then((r) => console.log(r.url))
+ +

test.html は service worker sw.js によって制御されています:

+ +
onfetch = (e) => {
+  e.respondWith(fetch('/page2').then((r) => {
+    r.usefinalURL = true;
+    return r;
+  })
+}
+ +

usefinalURL を設定すると、 response のURLが要求のURLに設定されないため、出力は index.html の /test ではなく /page2 になります。

+ +

ブラウザーの互換性

+ + + +

{{Compat("api.Response.useFinalURL")}}

+ +

関連項目

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