我的网页首先打开app.html。点击登录后,我需要打开index.html,我在iframe中打开它,然后在javascript.so中动态创建iframe以打开该i框架,并将其附加到document.body。但是它附加到 app.html 的正文中。但我需要在新页面中打开
var el = document.createElement("iframe");
el.setAttribute('id', 'ifrm');
el.setAttribute('name', 'ifrm');
el.setAttribute('src', '/index/index.html');
el.setAttribute('width', '100%');
el.setAttribute('height', '100%');
el.setAttribute('scrolling', 'no');
document.body.appendChild(el);
最佳答案
您可以使用它在新窗口中打开:
var myWindow = window.open("/index/index.html");
关于javascript - 打开 iframe src 到新页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22068650/