Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #31003
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Allow full screen |
| Date | 2016-08-01 11:23 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <11604253.uLZWGnKmhe@PointedEars.de> (permalink) |
| References | <w9Cdnc4bs-bBQAPKnZ2dnUU7-WHNnZ2d@westnet.com.au> |
Andrew Poulos wrote:
> I'm creating an elearning course which displays a YouTube video. When I
> preview the course in my browser the video's full screen button is enable.
>
> If I load the course into a learning management system (LMS) the full
> screen button is disabled. Dr Google tells me that's because the IFRAME
> which contains the video or a parent frame does not have the attribute
> allowfullscreen.
>
> When I look at the source the LMS creates when it displays the course I
> can see that the video is within an IFRAME, which is within a HTML
> document, within a FRAME, within a FRAMESET, within another FRAME,
> within a another FRAMESET.
>
> I cannot directly edit the source that the LMS creates. I have added the
> allowfullscreen attribute to the IFRAME that contains the video and I
> tried
>
> var frm = window.frameElement;
> while (frm) {
> frm.setAttribute("allowfullscreen","");
> frm = frm.frameElement;
> }
>
> but it appears that a FRAMESET returns null.
Not “null”, but “undefined”. That appears to work as designed:
,-<https://developer.mozilla.org/de/docs/Web/API/Window/frameElement>
|
| Returns the element (such as <iframe> or <object>) in which the window is
| embedded, or null if the element is either top-level or is embedded into a
| document with a different script origin; that is, in cross-origin
| situations.
A “frameset” element is not an element in which a window is *directly*
embedded; that would, at most, be the frameset’s child “frame” element.
> My question is how do I move "up the tree" though any nested FRAMESET to
> add the attribute to all parent FRAMES and,
As described in the FAQ^W^W^W^W^WAmazingly, it is _not_ described in the FAQ
or FAQ Notes although it is a feature of DOM Level 0. (Anyone up for
writing that part?)
See <https://developer.mozilla.org/en-US/docs/Web/API/Window/parent>
However, the “allowfullscreen” attribute appears to be defined (and make
sense) for “iframe” and “object” elements only.
> if I do, will the attribute actually be "noticed" by the video (seeing its
> been added after the page has been rendered)?
Try and see. According to my tests, no.
However, SOP or CORS permitting, you can remove the "descendant" “iframe”
element (that already has that attribute), add the attribute to the
"ancestor" iframe element while the "descendant" “iframe” element is not in
the document, and restore the latter to its original place.
Or, probably better, clone the "descendant" “iframe” element object
recursively, add the attribute to the "ancestor", and replace the original
"descendant" element with the clone (WFM). (Of course, you have to work
your way from bottom to top and then back to bottom, and you might need to
save the document state, if you have an “iframe” in an “iframe” in an
“iframe”.)
[Chrome DevTools rock (even in Chromium 51). You can now create a “frame”
or “iframe” element with empty “src” (defaults to "about:blank" on the fly
*and* edit the embedded document, with the F2 key in the “Elements” tab.]
It would be better to fix the LMS. Since I presume you are still using
Moodle, it should be easy to fix; you should at least report this as a bug.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
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
Allow full screen Andrew Poulos <ap_prog@hotmail.com> - 2016-08-01 15:26 +1000
Re: Allow full screen Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-01 11:23 +0200
Re: Allow full screen Andrew Poulos <ap_prog@hotmail.com> - 2016-08-02 10:58 +1000
Re: Allow full screen Andrew Poulos <ap_prog@hotmail.com> - 2016-08-02 13:28 +1000
csiph-web