1

I have an embed tag inside my html page with src as some external URL (same origin). This embed tag populates some content inside my (parent)html page. From my parent html page (top window) I am not able to access contentWindow of tag. The content of <embed> tag is not media, instead its html content. A similar question was asked here but question did not get relevant response.

Note : please don't suggest me to use a iframe or object tag

Snippet :

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Embed content</title>
</head>

<body style="margin-bottom: 3rem;">
    <h1>Embed tag testing</h1>
    <div style="border: 1px solid maroon;width: 803px;">
        <embed id="custom-embed" src="validation.html" height="500px" width="800px">
    </div>
</body>

</html>
suhasa
  • 97
  • 1
  • 12
  • As far as I recall, contet of [`embed`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed) [is not part of the accessable DOM](https://stackoverflow.com/questions/43610519/how-to-access-dom-elements-of-document-from-embed-tag). Why not use an `iframe`? – Lain Oct 31 '22 at 10:56
  • For SVG docs there is a `getSVGDocument()` method. But beware, there is active work specs wise to deprecate `` and `` in the long run. You probably don't want neither to keep using it, but even less start using it today. – Kaiido Oct 31 '22 at 14:11
  • Thanks for your responses @Lain and Kaiido Indeed it seems like it is not going to be supported as well itseems : https://github.com/whatwg/html/issues/7140 – suhasa Nov 02 '22 at 05:44

0 Answers0