Location
オブジェクト[23] Location
オブジェクトは、
閲覧文脈の活性文書の文書の番地を表します。
また、閲覧文脈のセッション履歴を変更する API
を提供します。 >>12
[7] URLUtils
としての動作は
location.href
を参照。
WorkerLocation
インターフェイス (DOM)[10] WorkerLocation
オブジェクトは、
WorkerGlobalScope
オブジェクトのURL
を表します。
location
IDL属性[21] window.location
IDL属性の取得器は、
次のようにしなければなりません >>12。
[16] document.location
IDL属性の取得器は、
次のようにしなければなりません >>12。
[85]
window.location
と document.location
は
PutForwards=href
です。
>>12
つまり、
window.location = url
は
window.location.href = url
と等価です。
[88]
なお location.href
は
stringifier
として定義されています。
従って Location
オブジェクトの
toString
メソッドは
location.href
の取得器と等価です。
つまり、
window.location
を文字列連結すると
location.href
とみなされます。
[89]
先日 SNS で window.location
の setter は
HTML Standard
に規定がないとか解説している人を見かけましたが、
誤りです。
初期の初期からしっかり規定されています。
そのように仕様書を引いてもっともらしいことを書いていても、
正確に読み込んでいるとは限らないので注意しましょう。
[13] Window
オブジェクトは、
固有の Location
オブジェクトを持ちます。
Window
オブジェクトの作成時に
Location
オブジェクトが割り当てられます。 >>12
[14] document.open
で Location
オブジェクトは新しいものに差し替えられるとされていましたが、
その規定は削除されています。
[42] Location
は、同じ起源でなくてもアクセスできる例外的なオブジェクトです。
(そのような性質を持つのは他に WindowProxy
だけです。)
[43] 同じ起源からアクセスした時と、それ以外からアクセスした時とで、 動作がかなり変わります。
[44] JavaScript の内部メソッドは次のように動作しなければなりません >>12。
IsPlatformObjectSameOrigin(this)
が真IsPlatformObjectSameOrigin(this)
が偽! OrdinaryGetPrototypeOf(this)
を返します。OrdinaryGetOwnProperty(this, P)
に設定します。this
の DefaultProperties の値に P が含まれるなら、this
のDefaultPropertiesの値が P を含むなら、? OrdinaryDefineOwnProperty(this, P, Desc)
を返します。? OrdinaryGet(this, P, Receiver)
を返します。? CrossOriginGet(this, P, Receiver)
を返します。? OrdinarySet(this, P, V, Receiver)
を返します。? CrossOriginSet(this, P, V, Receiver)
を返します。! OrdinaryOwnPropertyKeys(this)
を返します。! CrossOriginOwnPropertyKeys(this)
を返します。[28] JavaScript 1.0 で Location
オブジェクトが導入され、URL分解属性が追加されました。
[29] JavaScript 1.1 で reload
と
replace
が追加されました。
[30] location.origin
は10年代に追加されました。
[2] Re: WebIDL and prototype chains (Maciej Stachowiak 著, 版) http://lists.w3.org/Archives/Public/public-webapps/2009JulSep/0269.html
[3] [whatwg] JS "redirects" and session history ( 版) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-July/027372.html
[4] Web Applications 1.0 r7512 Make sure <iframe name=location> doesn't override Document.location ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7511&to=7512
[5] Window Object 1.0 ( ( 版)) http://www.w3.org/TR/Window/#window-location
[6] [whatwg] Location object identity and navigation behavior ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-January/038527.html
[319] [whatwg] Spec for location object needs to make some properties unforgeable; need supporting WebIDL changes ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-November/038015.html
[320] [whatwg] Location object identity and navigation behavior ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-November/038014.html
[321] [whatwg] Proposal: location.parentOrigin ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-November/038019.html
[322] Web Applications 1.0 r7513 Update Location's members to point to the right document. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7512&to=7513
[323] Web Applications 1.0 r7514 Make Location be protected from cross-origin access like Window. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7513&to=7514
[324] Web Applications 1.0 r7515 More security fixes: Location is now entirely Unforgeable, and wording for some other security paragraphs is now consistent. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7514&to=7515
[325] Web Applications 1.0 r7516 Location's security model is actually different than Window's. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7515&to=7516
[326] Window Object 1.0 ( ( 版)) http://www.w3.org/TR/Window/#location
[327] Web Applications 1.0 r7758 Allow custom properties on Location objects to work for the Document whose Location object it originally was. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7757&to=7758
[328] Web Applications 1.0 r7846 Try to match reality better for dynamic location.hash navigation. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7845&to=7846
[405] IRC logs: freenode / #whatwg / 20131010 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20131010
[407] IRC logs: freenode / #whatwg / 20131213 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20131213
[408] IRC logs: freenode / #whatwg / 20140205 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20140205#l-961
[409] Cross-origin windows and how to explain them in ECMAScript semantics ( (David Bruant 著, 版)) http://lists.w3.org/Archives/Public/public-script-coord/2014JanMar/0140.html
[8] Inline URLUtilsReadOnly · whatwg/html@32a7a20 ( 版) https://github.com/whatwg/html/commit/32a7a2092eeff52aca78a0224816a9b327893cc6
[9] Give workers a base URL and clean up shared workers · whatwg/html@b620471 ( 版) https://github.com/whatwg/html/commit/b620471ff823e8e6507b077cf0785a530762f5e3
[15] Tie Location to the Window object · whatwg/html@fdd8216 ( 版) https://github.com/whatwg/html/commit/fdd8216a902a065dd3e205cbbc1b5a6b527970a2
[36] Cross-origin objects: do not wrap JavaScript functions ( (annevk著, )) https://github.com/whatwg/html/commit/db361b608157b5cf9fd0d491d7dc76cdce80380b
[45] Explain why cross-origin properties are configurable (domenic著, ) https://github.com/whatwg/html/commit/7891ea33f643f2b6af18dacc532378671c922b76
[50] document.location requires document to be fully active (annevk著, ) https://github.com/whatwg/html/commit/126ec9eadb149285c8f41a40929ff53ca8112826
[51] Throw for cross-origin [[Delete]] and use "SecurityError" as needed (annevk著, ) https://github.com/whatwg/html/commit/9b22d034cd5a89cac9e54174d009ef8a256bcf13
[52] Make Location's toString() work and drop its toJSON() (annevk著, ) https://github.com/whatwg/html/commit/74a78cb74c07b81bc195bdf50d90811f8f5ee5aa
[53] Remove javascript URL case from <a>/<area>/Location hash setter (annevk著, ) https://github.com/whatwg/html/commit/deea9fba916cb6e66c7dcfc57442cf25ac0441a1
[54] Tweak the exposure of cross-origin properties (domenic著, ) https://github.com/whatwg/html/commit/79b4fbc6cfa2123620fa05c27579f4ec1e7d9c5d
[55] Why are indexed properties on WindowProxy not enumerable in the spec? · Issue #2753 · whatwg/html () https://github.com/whatwg/html/issues/2753
[56] Why are indexed properties on WindowProxy not enumerable in the spec? · Issue #2753 · whatwg/html () https://github.com/whatwg/html/issues/2753
[57] Tweak the exposure of cross-origin properties by domenic · Pull Request #2777 · whatwg/html () https://github.com/whatwg/html/pull/2777
[58] Enumerate fewer cross-origin properties (annevk著, ) https://github.com/whatwg/html/commit/ad8823782e7f6b7d60f8e216901bb76d1a53dd6d
[59] Enumerable cross-origin properties don't seem to be web-compatible · Issue #3183 · whatwg/html () https://github.com/whatwg/html/issues/3183
[70] Enumerate less cross-origin properties by annevk · Pull Request #3186 · whatwg/html () https://github.com/whatwg/html/pull/3186
[71] Make crossOriginObject.then undefined for promises (annevk著, ) https://github.com/whatwg/html/commit/6031e3a2d66ee2ff11d09abd18e6a25a3c78c5ba
[72] No way to resolve a Promise with a cross domain WindowProxy · Issue #536 · whatwg/dom () https://github.com/whatwg/dom/issues/536
[73] Make crossOriginObject.then undefined for promises by annevk · Pull Request #3242 · whatwg/html () https://github.com/whatwg/html/pull/3242
[74] WindowProxy and Location use ordinary internal methods by default (annevk著, ) https://github.com/whatwg/html/commit/44da6795888d90cc7d4181a57e5b7aeafe461fb5
[75] Correct branching logic in choosing a browsing context by annevk · Pull Request #4197 · whatwg/html () https://github.com/whatwg/html/pull/4197
[76] Handle cross-origin "then" and friends at a later point (annevk著, ) https://github.com/whatwg/html/commit/5e370be9b9d48fe5106472db0ea65e01c64387bc
[77] Handling of "then" on cross-origin windows doesn't match what we agreed to do or browsers · Issue #4251 · whatwg/html () https://github.com/whatwg/html/issues/4251
[78] Handle cross-origin "then" and friends at a later point by annevk · Pull Request #4269 · whatwg/html () https://github.com/whatwg/html/pull/4269
[79] WindowProxy and Location use ordinary internal methods by default (annevk著, ) https://github.com/whatwg/html/commit/44da6795888d90cc7d4181a57e5b7aeafe461fb5
[80] Should clearly define that the ordinary object internal methods are used when not stated otherwise for WindowProxy and Location · Issue #4189 · whatwg/html () https://github.com/whatwg/html/issues/4189
[81] Clarify that WindowProxy and Location use ordinary internal methods by default by annevk · Pull Request #4191 · whatwg/html () https://github.com/whatwg/html/pull/4191
[82] Only run "perform a security check" for Window and Location objects (annevk, , ) https://github.com/whatwg/html/commit/e46fc2f59a064ab4e45b9f3e6fa9322ad591ef0f
[83] Only run "perform a security check" for Window and Location objects by annevk · Pull Request #5141 · whatwg/html () https://github.com/whatwg/html/pull/5141
[84] Consolidate performing a security check in the spec with implementations · Issue #2360 · whatwg/html () https://github.com/whatwg/html/issues/2360
window.location
やその省略形のlocation
を使う場合が多く、document.location
はあまり使われません。