是否可以打开一个新窗口并嵌入iframe? [英] Is it possible to open a new window and embed iframe in to this?

查看:1017
本文介绍了是否可以打开一个新窗口并嵌入iframe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要打开一个新窗口,我想在iframe中嵌入一个视频并在此窗口中显示。正常的弹出窗口语法是:

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)

如何传递iframe代码而不是URL,以便iframe嵌入新窗口?请建议。

How will I pass the iframe code instead of URL so that the iframe is embedded in the new window? Please suggest.

提前致谢。

推荐答案

你不要t将iframe代码传递给 window.open ,您将获得正在打开的窗口的句柄并将iframe写入该窗口。

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>')

这篇关于是否可以打开一个新窗口并嵌入iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆