JavaScript embed contentWindow -
I'm trying to do a JavaScript It is loading and embedding I can post messages to parents, but in some way I can not post in embeds. Did I try: current embed setup: Any solutions for this? If you want to get an element by ID in JS, you have to enter an ID in your element So that the JS script can find it: If you do not want to use the ID, you can use the GetElementsByTagName function to retrieve your element, such as: Wondo property about content, it seems that it is only an IFrame property. So you have to use another property or switch back to iframe. More here: postMessage , such as you do for an iframe Now, an embed I have to use an embed as it is for an app that is loaded on iOS device, and when there is a bug with IFrame width and height in iOS then I have to use an embed .
document.getElementById ("embed") contentWindow.postMessage (...) document.getElementById ("embed"). ContentDocument.postMessage (...) GetElementById ("Embed") document. Document. PostMessage (...) document.getElementById ("Embed"). GetSVGDocument () / / empty return
& lt; Embed src = "URL" id = "embed" type = "text / html" & gt; & Lt; / Embed & gt;
& lt; embed id = "embed" src = "URL" type = "text / html" & gt; & Lt; / Embed & gt;
// If you are only an element of that type of document. GetElementsByTagName ("Embed") [0] .doSomething (); // If you have many embedded elements, embed embed = document. GetElementsByTagName ("embed"); (Var i = 0; i & lt; embeds.lenght; i ++) {document.getElementsByTagName ("embed") [i] .doSomething (); }
Comments
Post a Comment