/
77.txt
153 lines (110 loc) · 7.19 KB
/
77.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
[16] [[文書]]には、[DFN[[F[[RUBYB[文書の番地]@en[document's address]]]]]]があります。
[[文書の番地]]は、通常はその[[文書]]の取得元の [[URL]] ですが、
[[スクリプト]]の操作などにより異なる値となることもあります。
* 仕様書
[REFS[
- [1] [CITE@en-US[DOM Standard]] ([TIME[2014-09-14 14:03:21 +09:00]] 版) <https://dom.spec.whatwg.org/#dom-document-url>
- [2] [CITE@en-US[DOM Standard]] ([TIME[2014-09-14 14:03:21 +09:00]] 版) <https://dom.spec.whatwg.org/#concept-document-url>
- [3] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2014-09-16 21:36:14 +09:00]] 版) <https://html.spec.whatwg.org/#documents>
- [18] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2015-11-04 19:30:07 +09:00]] 版) <https://html.spec.whatwg.org/#concept-workerglobalscope-url>
]REFS]
* [CODE(JS)@en[document.URL]]
[4]
[[DOM HTML]]、[[Firefox]] 2.0、[[Opera]] 9 では
[CODE(DOMa)@en[[[URL]]]] [[属性]]を[[読取専用]]としていますが、
[[WinIE 6]] では値の[[設定]]もできます。
[CODE(JS)@en[[CODE(DOMa)@en[[[location]]]].[CODE(DOMa)@en[[[href]]]]]]
のように、与えられた [[URI]] に[[遷移]]します。
;;
<http://suika.fam.cx/~wakaba/-temp/test/dom/document/meta/url/set-http-1.html>
[7] [CITE@en-us[url Property (DOMDocument)]]
( ([TIME[2013-05-12 05:14:37 +09:00]] 版))
<http://msdn.microsoft.com/en-us/library/ms767669(v=vs.85).aspx>
* [CODE(JS)@en[document.documentURI]]
[12] [[Firefox]] 2.0 と [[Opera]] 9 は [CODE(DOMa)@en[[[documentURI]]]]
[[属性]]を実装しています。 [[WinIE 6]] は実装していません。
;;
<http://suika.fam.cx/~wakaba/-temp/test/dom/document/meta/document-uri/get-1.html>
[13] >>12 いずれも、値の設定はできないようです。
;;
<http://suika.fam.cx/~wakaba/-temp/test/dom/document/meta/document-uri/set-http-1.html>
* 実際と異なる URL
[27] [[文書の番地]]は、 [[navigate]] で初期値が設定されます。
[14] [[文書の番地]]は、次の場合に実際とは異なる (同じ瞬間に同じ条件で [[fetch]]
していたとしても同じものが得られない) [[URL]] に設定されます。
[FIG(list)[
- [CODE(DOMm)@en[[[pushState]]]]/[CODE(DOMm)@en[[[replaceState]]]] 後
- [[[CODE(HTMLe)@en[iframe]] [CODE(HTMLa)@en[srcdoc]]文書]]
- [CODE(JS)@en[[[window.open]]]] 後
- [CODE(URI)@en[[[javascript:]]]] への [[navigate]] 後
- [[navigate]] 以外の方法で作られた[[文書]]
]FIG]
[26] [CODE(URI)@en[view-source:]] も参照。
* ワーカーの URL
[19] [CODE(DOMi)@en[[[WorkerGlobalScope]]]] [[オブジェクト]]は、 [DFN[[F[[RUBYB[URL]@en[url]]]]]] を持ちます。
その値は [[URL]] または [[null]] です。初期値は [[null]] です。 [SRC[>>18]]
;; [22] この値は [[run a worker]] の過程で設定されます。
[[ワーカー]]の[[スクリプト]]の実行時点では、
[[スクリプト]]の [[URL]] となっています。
[23] [[ワーカーのURL]]には、 [CODE(DOMi)@en[[[WorkerLocation]]]]
[[オブジェクト]]を介してアクセスできます。
;; [24] [[ワーカー]]外から直接アクセスする方法はありません。
;; [21] [[共有ワーカー]]には[F[[[ワーカーのURL]]]]の他に[F[[[構築子URL]]]]があります。
[F[[[ワーカーのURL]]]]は[[リダイレクト]]等を経た最終的な実際の [[URL]]
で、[F[[[構築子URL]]]]はその前の呼び出し元が指定した[[URL]]です。
* 関連
[17] [[環境設定群オブジェクト]]の[F[[[作成URL]]]]は、[[文書の番地]]とは違って、
[CODE(DOMm)@en[[[pushState]]]] 等により影響されない最初の [[URL]] となります。
* 歴史
[5] [CITE[''''''[''''''whatwg'''''']'''''' Reconcile document.URL and document.documentURI?]]
( ([TIME[2012-01-14 12:22:47 +09:00]] 版))
<http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-January/034377.html>
[6] [CITE@en[Web Applications 1.0 r7145 sync with dom core]]
( ([TIME[2012-06-27 04:29:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7144&to=7145>
[8] [CITE@en[Web Applications 1.0 r7159 Turns out that browsers don't distinguish between the 'document's address' and the 'documents's current address', so we can merge them.]]
( ([TIME[2012-06-29 10:23:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7158&to=7159>
[9] [CITE[''''''[''''''whatwg'''''']'''''' Document's base URI should use the document's *current* address]]
( ([TIME[2012-06-29 17:17:08 +09:00]] 版))
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-June/036504.html>
[10] [CITE[IRC logs: freenode / #whatwg / 20120629]]
( ([TIME[2012-07-15 16:06:48 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20120629>
[11] [CITE[IRC logs: freenode / #whatwg / 20130117]]
( ([TIME[2013-01-18 21:01:10 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20130117#l-766>
[15] [CITE[The HTTP Protocol As Implemented In W3]]
([TIME[1999-10-27 03:45:32 +09:00]] 版)
<http://www.w3.org/Protocols/HTTP/AsImplemented.html>
[20] [CITE@en[Give workers a base URL and clean up shared workers · whatwg/html@b620471]] ([TIME[2015-11-06 19:47:09 +09:00]] 版) <https://github.com/whatwg/html/commit/b620471ff823e8e6507b077cf0785a530762f5e3>
[25] [CITE@en[Fix #118: clarify documentURI/URL and baseURI return a serialized value · whatwg/dom@b4664d6]]
([TIME[2016-01-02 11:27:33 +09:00]] 版)
<https://github.com/whatwg/dom/commit/b4664d65f494be62141c85a5efb9c367de8c70bc>
[28] [CITE@en[Rename document's address to URL]]
( ([[annevk]]著, [TIME[2016-05-06 02:06:55 +09:00]]))
<https://github.com/whatwg/html/commit/16dd60cfb1cbd4ea3dcacc91f58b368b021ded33>
[29] [CITE@en[Use USVString for URLs and origins in IDL]]
( ([[zcorpan]]著, [TIME[2016-05-20 21:56:11 +09:00]]))
<https://github.com/whatwg/dom/commit/1bb85a48e07d1000e00bd792d61247b9a5e2e4ae>
[30] [CITE@en[document.open URL handling is fishy · Issue #3286 · whatwg/html]]
([TIME[2018-08-23 20:17:12 +09:00]])
<https://github.com/whatwg/html/issues/3286>
[31] [CITE@en[document.open() simplifications, part 2]]
([[TimothyGu]]著, [TIME[2018-08-21 03:57:31 +09:00]])
<https://github.com/whatwg/html/commit/ae7cf0cc1936c6c309d7279c822dffc3af147851>
[32] [CITE@en[document.open() can make a document's URL go out of sync with its history entry · Issue #3885 · whatwg/html]]
([TIME[2018-09-05 22:40:37 +09:00]])
<https://github.com/whatwg/html/issues/3885>
[33] [CITE@en[document.open() can make a document's URL go out of sync with its history entry · Issue #3885 · whatwg/html]]
([TIME[2018-09-05 22:43:21 +09:00]])
<https://github.com/whatwg/html/issues/3885>
[34] [CITE@en[document.open() simplifications, part 2 by TimothyGu · Pull Request #3946 · whatwg/html]]
([TIME[2018-09-05 22:44:04 +09:00]])
<https://github.com/whatwg/html/pull/3946>
[35] [CITE@en[document.open(): remove fragment before propagating entry document's URL]]
([[TimothyGu]]著, [TIME[2018-08-29 15:39:05 +09:00]])
<https://github.com/whatwg/html/commit/ae688ea9845f145d6a7b31c67e727b56442ceada>
[36] [CITE@en[Unclear what to do with fragments on document.open · Issue #2555 · whatwg/html]]
([TIME[2018-09-20 23:40:20 +09:00]])
<https://github.com/whatwg/html/issues/2555>