I need to open a new window and I want to embed a video in an iframe and show it in this window. As normal pop-up window syntax is:
window.open(URL,name,specs,replace)
How will I pass the iframe code instead of URL so that the iframe is embedded in the new window? Please suggest.
Thanks in advance.
Yes you can open a new Window from iFrame........
In action: iframeAn <iframe> tag hosts a separate embedded window, with its own separate document and window objects.
How do I do this? Thanks! By adding target="_blank" to the anchor, it will open it in a new tab. By adding target="_parent" to the anchor, it will open it up in the same window like a normal link.
To embed an iframe in a content page, select Interactive layout, choose the HTML block and paste the iframe code there. You can adjust the iframe width and height properties. To embed an iframe using the Old (Classic) editor, click on the Embed Media icon and paste the code in the appropriate field.
You don't pass the iframe code to window.open
, you get a handle on the window you are opening and write the iframe to that window.
var win = window.open();
win.document.write('<iframe width="560" height="315" src="//www.youtube.com/embed/mTWfqi3-3qU" frameborder="0" allowfullscreen></iframe>')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With