-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<embed>
elements (HTMLEmbedElement) do not have contentWindow or contentDocument
#7140
Comments
On the one hand this seems somewhat reasonable, but on the other hand we don't really want folks to use the |
I would personally not use In w3c/webextensions#12, there is a request for an extension API to allow extensions to communicate between content scripts (i.e. extension scripts that run in an execution environment that differs from the web page itself). Since extensions may operate on arbitrary pages, they may encounter Without With |
Can we expose element APIs to extensions only? It seems reasonable to use these names as we wouldn't ever use them for something else, but extensions is not a sufficient reason to expose them to websites directly. |
At least in Firefox that is possible (and we use it very sparingly), but I cannot speak for all other implementations. For dangerous APIs, I see value in restricting them to extension use cases only, but I also believe that fragmentation of APIs should be avoided where possible.
I mentioned a non-extension use case in the initial report, |
+1 for not adding anything to embed (outside extension APIs). We want to discourage use of it as much as possible, so feature gaps are good and should be preserved. |
I agree. Avoiding to add new features to embed or object is preferable. |
Removing agenda+ as I think there is a clear answer here at this point. @Rob--W are you okay with restricting this to extensions? |
Since there seems to be broad consensus here to not add a In the WECG we have decided to not add an extension-only |
Hi there, This might be an abandoned topic yet still wanted to point out the advantage of object ( & embed) tag over iframe, which is the auto-sizing effect, while maintaining (axes) proportion (just like img tag), ideal for (animated) SVGs for instance. Just noticed Firefox (from version 112+) returns now null for object.contentWindow if same domain policy is not met (however iframe is still working well), which seems a step back... |
HTML documents can be loaded with
<iframe src>
,<frame src>
,<object data>
and<embed src>
.The first three elements allow the content to be referenced via
.contentWindow
and.contentDocument
..contentWindow.postMessage
can be used to communicate with the frame.<embed>
does not have these properties, and it is not straightforward to usepostMessage
with a document in an<embed>
.Presently, an API that internally operates on
BrowsingContext
s usually take aWindowProxy
. This works for common cases, except for<embed>
. For example, thewindow.postMessage
API is designed to offer a cross-origin communication mechanism, but the absence of a.contentWindow
property prevents this from being used with documents in<embed>
elements [note 1].With the removal of plugin support from the web platform, I see no reason to not treat
<embed>
similarly as the other ways to embed documents. Ideally,HTMLEmbedElement
should have an interface that's consistent with iframes, and at least include thecontentWindow
(andcontentDocument
) properties.<object>
s were also used for plugins, and nowadays they also have a.contentWindow
: https://wpt.fyi/results/html/semantics/embedded-content/the-object-element/object-attributes.html[note 1]
window.frames[]
does include windows from<embed>
, but it is not possible to tell whether an item inwindow.frames[]
belongs to a specific<embed>
, except in the same-origin case, whereframes[i].frameElement
can be compared with an<embed>
element.The text was updated successfully, but these errors were encountered: