Skip to content
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> does not handle network errors #1461

Closed
annevk opened this issue Jun 23, 2016 · 8 comments
Closed

<embed> does not handle network errors #1461

annevk opened this issue Jun 23, 2016 · 8 comments

Comments

@annevk
Copy link
Member

annevk commented Jun 23, 2016

The current set of steps seem to assume there's always a response.

@annevk
Copy link
Member Author

annevk commented Jun 23, 2016

<embed src=http://test:test/ onerror=w(1) onload=w(2)></embed> gives 2 in Chrome, nothing in Firefox...

@domenic
Copy link
Member

domenic commented Jul 15, 2020

Closed by 63a0e64 but GitHub isn't picking that up... there seems to be some general degraded GitHub status.

@laukstein
Copy link

laukstein commented Sep 4, 2021

@domenic, should we be able to identify trough JavaScript if iframe failed to load (is blocked by network or CSP)?

Currently with what I can came up is in onload event

const isLoaded = event.target.contentDocument ||
    event.target.contentWindow.window && event.target.contentWindow.window.length ||
    event.target.contentWindow.location && event.target.contentWindow.location.href;

but it will fail on Firefox due to issue https://bugzilla.mozilla.org/show_bug.cgi?id=1552504
Chrome will not fire onerror event (based on spec) https://bugs.chromium.org/p/chromium/issues/detail?id=365457

Is there any spec approach for it?

@laukstein
Copy link

@mfreed7 was it security concern to fire onload and not onerror when iframe failed to load by CSP or blocked network? Otherwise it should be considered as a bug in spec. cc @domenic @paulirish

@domenic
Copy link
Member

domenic commented Sep 6, 2021

It is intentional to align with 2/3 browsers here. Embed is a legacy element and we are working to simplify it as much as possible.

@laukstein
Copy link

laukstein commented Sep 8, 2021

@domenic, I am referring to <iframe> element.

I think Chrome Issue #365457, Issue #899559 and Issue #938279, and likely other browsers are missing this part

https://html.spec.whatwg.org/multipage/iframe-embed-object.html
If the load failed (e.g. there was an HTTP 404 error, there was a DNS error), fire an event named error at the element, then jump to the step below labeled fallback.

Chrome doesn't fire error event and instead fires load event when iframe load failed by CSP or other reason.

@domenic
Copy link
Member

domenic commented Sep 8, 2021

Yes, that's per spec, and also unrelated to this issue, so this is not a good place to discuss it.

@laukstein
Copy link

@domenic, can you please collaborate in https://bugs.chromium.org/p/chromium/issues/detail?id=899559#c9 and make clear the iframe error spec? I think there has been some misunderstanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants