如何在新窗口中打开 iframe?我尝试使用“scrolling='auto'”。它不起作用。
我把我的代码放在这里:
<iframe width="572px" scrolling="auto" height="335px"
frameborder="1" src="http://XXXX.com/iframe-page"
style="border: 0px none #ffffff;" name="national-campaign"
marginheight="0px" marginwidth="0px">
</iframe>
Run Code Online (Sandbox Code Playgroud)
我想在新窗口中打开链接。我有两个网站,一个公司网站和一个经销商网站。在公司网站上,我有一个页面,其中只有一个图像,我想在公司网站和经销商网站上显示该图像。当您点击图片时,它会进入查看详细信息页面。但是,我在经销商网站中想要的是,当您单击 iframe 图像时,它会在新窗口中打开选项卡,而不是在 iframe 内显示详细信息页面。
有任何想法吗?干杯。
您可以使用 jquery 和 window.open 方法来完成。
HTML:
<iframe id="iframe" width="572px" scrolling="auto" height="335px"
frameborder="1" src="http://XXXX.com/iframe-page"
style="border: 0px none #ffffff;" name="national-campaign"
marginheight="0px" marginwidth="0px">
</iframe>
Run Code Online (Sandbox Code Playgroud)
JS:
var iframe = $("#iframe");
var newWindow = window.open(iframe.attr(src), 'Dynamic Popup', 'height=' + iframe.height() + ', width=' + iframe.width() + 'scrollbars=auto, resizable=no, location=no, status=no');
newWindow.document.write(iframe[0].outerHTML);
newWindow.document.close();
iframe[0].outerHTML = ''; // to remove iframe in page.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
63014 次 |
最近记录: |