New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 853178 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

javascript setAttribute iframe allowfullscreen doesn't work

Reported by peterejk...@gmail.com, Jun 15 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36

Steps to reproduce the problem:
I have a map in an iframe (Chrome 67.0.3396.87). E.g.

<iframe height="480px" 
src="http://brunob.github.io/leaflet.fullscreen/" 
width="450px">
</iframe>

The CMS we use strips out the allowfullscreen attribute from the iframe, so I'm trying to inject them back in using Javascript.

document.getElementsByTagName("iframe")[0].getAttribute("src") == "http://brunob.github.io/leaflet.fullscreen/" ? document.getElementsByTagName("iframe")[0].setAttribute("allowFullScreen", ""):null;

What is the expected behavior?
The allowfullscreen attribute will allow the map to go full screen. It does in IE 11 and Firefox 60.0.1

What went wrong?
The javascript changes the DOM, but the fullscreen button still doesn't work. However, if you start with the iframe and allowfullscreen set, then it does work.

<iframe height="480px" 
src="http://brunob.github.io/leaflet.fullscreen/" 
width="450px" allowfullscreen>
</iframe>

Did this work before? N/A 

Chrome version: 67.0.3396.87  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 30.0 r0

see also: https://stackoverflow.com/questions/50875766/javascript-setattribute-iframe-allowfullscreen-doesnt-work-in-chrome
 

Comment 1 by woxxom@gmail.com, Jun 15 2018

Bisected to r495331 = 5d8010e1fc081481d0646618e700b51a4699ab4c
"Reenable feature policy control over fullscreen"

Quoting the CL:

   Dynamic modification of the allowfullscreen flag has no effect until
   the iframe contents are navigated/reloaded.

So this is working as intended.
This functionality is different from IE and Firefox. Is there a workaround here?

Comment 3 by woxxom@gmail.com, Jun 15 2018

You need to set the attribute before the iframe starts loading, otherwise you'll have to reload the iframe contents.
Chrome implements this spec: https://wicg.github.io/feature-policy/#integration-with-html

  The allowfullscreen attribute is a boolean attribute. 
  When specified, it indicates that Document objects in the iframe element’s 
  browsing context should be initialized with a feature policy which allows 
  the fullscreen feature to be used from any origin

It's not clear to me whether the spec explicitly disallows dynamic changing of this attribute. And if it does, why. From a layman's point of view, I'd say the embedder page has every right to change this attribute dynamically on an already loaded iframe. It'd be helpful if iclelland@ could clarify this.
Cc: ekaramad@chromium.org loonyb...@chromium.org alex...@chromium.org iclell...@chromium.org
Components: -Blink Blink>FeaturePolicy
+iclelland@ to clarify, but I also think that this was an intentional change and you're seeing expected behavior.  It also matches how the "sandbox" attribute and "allow" feature policy attribute work.  For the allowfullscreen to take effect, you need to navigate the iframe (e.g., set the src to something else) after changing allowfullscreen.
Yes, this is an intentional change to the platform to align with "sandbox" and "allow", and the existing "allowusermedia" and "allowpaymentrequest" attributes. The embedder certainly can change the attribute, but like sandbox, the result doesn't take effect until the frame navigates.

As part of feature policy, one of the goals is for sites to have a consistent set of available features, which doesn't change over the lifetime of the document.

The original intent thread on blink-dev for this is here: https://groups.google.com/a/chromium.org/d/msg/blink-dev/UKChYGBYvSk/dXXdHGyhBwAJ


Labels: Needs-Triage-M67
iclelland@ Thanks for the update.

As per comment #5, as this is an intentional change, can we close this issue?

Thanks.. 
Labels: Triaged-ET Needs-Feedback
As per comment #7 adding Needs-Feedback to it.

Thanks.!

Comment 9 by cha...@chromium.org, Jun 21 2018

Owner: iclell...@chromium.org
Ian, I think we can close this as WAI. Please comment/confirm.
Yes, this is WAI. The HTML spec is being updated with this behaviour, and I'm going to be filing browser bugs at that point for the other engines.

The workaround is generally going to be to grant fullscreen access to the page before loading it, or to reload the frame after adding the attribute. (If you control the destination page, you can even have it stash any local state and reload itself once the container attribute has been updated)
Status: WontFix (was: Unconfirmed)
WontFixing per #10.

Sign in to add a comment