Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19761
| Message-ID | <2083966.lBPHQm9WGc@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2013-05-16 11:12 +0200 |
| Subject | Re: Find an object in a window |
| Newsgroups | comp.lang.javascript |
| References | <G4WdnS1OUt3I-AnMnZ2dnUVZ_vadnZ2d@westnet.com.au> |
Andrew Poulos wrote:
> I tried writing a recursive function (that sits in the elearning page)
> that searched all frames in the elearning's top window and in the top
> window of any opener which appears to work:
>
> function findAPI(win) {
> if (win.API) {
> return win.API;
> }
>
> for (var i = 0; i < win.frames.length; i++) {
var api = findAPI(win.frames[i]);
if (api) {
return api;
> }
> }
>
> if (win.opener && !win.opener.closed) {
> return findAPI(win.opener.top);
> }
> }
>
> function fLook() {
> var foundApi = findAPI(window.top);
> window.alert(foundApi);
> }
>
> Any ideas on how to make this (more) robust? For example, its not
> checking nested frames.
Now it does.
--
PointedEars
Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Find an object in a window Andrew Poulos <ap_prog@hotmail.com> - 2013-05-16 14:49 +1000
Re: Find an object in a window Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-16 11:12 +0200
Re: Find an object in a window Andrew Poulos <ap_prog@hotmail.com> - 2013-05-16 22:12 +1000
Re: Find an object in a window Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-18 16:25 +0200
Re: Find an object in a window Andrew Poulos <ap_prog@hotmail.com> - 2013-05-19 10:06 +1000
csiph-web