Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to open a new window and embed iframe in to this?

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.

like image 230
ambikanair Avatar asked Nov 27 '13 06:11

ambikanair


People also ask

Can an iframe open a new window?

Yes you can open a new Window from iFrame........

Is iframe a separate window?

In action: iframeAn <iframe> tag hosts a separate embedded window, with its own separate document and window objects.

How do I make an iframe link open in a new tab?

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.

How do I embed an iframe?

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.


1 Answers

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>')
like image 68
Rob M. Avatar answered Oct 13 '22 01:10

Rob M.