Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin.stu.neva.ru!news.tu-darmstadt.de!news.belwue.de!rz.uni-karlsruhe.de!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <1401679.AFRqVoOGUt@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Thu, 10 May 2012 19:26:50 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Newsgroups: comp.lang.javascript References: Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 52 NNTP-Posting-Date: 10 May 2012 19:26:52 CEST NNTP-Posting-Host: d2b210f3.newsspool1.arcor-online.net X-Trace: DXC=HAUmh@j9WS7RLigj];iP=8ic==]BZ:af>4Fo<]lROoR1nkgeX?EC@@0gVYO=MmT0f:DZm8W4\YJNK0U@3`]Ai;Bf2I3[Lmc:B[T5 X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:13876 Andreas Bergmaier wrote: > Scott Johnson schrieb: >> I tried to call window.location.href ? .pathname which sends back the >> original name of the file the script is located '/~domain/music.html' as >> expected but not helpful. >> >> What I was thinking was place the window.location.pathname on the 'home' >> page set a global variable which can be read by the script on music.html. >> >> Is this even possible? >> Global variables accessible across scripts. > > You can access the global object of the parent window with "parent", > even the global object of the top window with "top" for deeply nested > frames. `parent' and `top' are actually properties of Window objects. > Precondition is that both pages are located in the same domain > for security reasons, which will be no problem in your case. Without further measures, it must be the same protocol, the same domain, and the same port number (Same Origin Policy). It may also be possible if both protocol and port number match and the URIs used to access both resources are in the same subdomain (simplest case: same second-level domain). I am not sure if assigning to `document.domain' still works in recent browsers. I have not tried again; no use-case. But it would certainly be tested as part of a DOM Support Matrix. > So you may check parent.location.href, […] The `href' property of Location objects was tainted, the `location' property of Window objects was not. So, slightly greater efficiency aside, it appears to be safer and more flexible to use the `location' property instead. It appears to have a getter which returns the value of the `href' property of the referred Location object. PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann